Virtualmin create-domain not showing response when triggered from the hosted server through a PHP interface

Hi Guys,

I am a newbie for using Virtualmin and have loved the supported features by virtualmin.
I am developing a utility with the help of which the Remote API of virtualmin can be triggered and respective methods should be executed using curl.

But I am facing a challenge in which the create-domain API with default features or web enabled, shows 404 after execution of the utility, but the virtual server will be created after execution. And this will only happen when I launch my utility from the same server on which Virtualmin is deployed. If i launch my utility from any other server or even my local machine the utility will work well.

What is working:
Virtual server is created successfully, when the script is triggered from any other machine other then the hosting sever for virtualmin, and successful JSON response is shown.

Whats not working:
When the script is launched from the same server then 404 is shown, but the server is created. The JSON response is not shown for this.

My hosting server is pointing to a domain and I am executing the script from the same domain. It seems like it is an issue of redirection .

Hosting server: https://www.xthemz.com:10000
Script location: https://www.xthemz.com/main/test.php.

Script:

public function createVirtualServer($domain, $passwd, $db, $plan) {
$results = array();
$options = ’ “’ . $this->uri . “program=create-domain” .
“&domain=” . $domain .
“&pass=” . $passwd .
“&plan=” . $plan .
“&db=” . $db . ‘db’ .
“&mysql=” .
“&dir=” .
“&unix=” .
“&dns=” .
“&web=” .
“&mail=” .
“&ssl=” .
“&spam=” .
“&virus=” .
“&logrotate=” .
“&multiline=” .
'&json=”’;

    $str = 'curl -k -u ' . $this->auth . $options;

    exec($str, $results);
    return explode(":", $results[1]);
}

I am stuck at this point because I need the response for proceeding further.

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.