Remote.cgi and creating domain issue?

7 posts / 0 new
Last post
#1 Thu, 01/13/2011 - 07:02
dwdcweb

Remote.cgi and creating domain issue?

I am attempting to take advantage of the remote API. When I attempt to create a non-existing domain it gives me that it exists for some reason.

why or what did I do wrong? here is the url to create it:

https://localhost:10000/virtual-server/remote.cgi?program=create-domain&domain=foo.com&pass=smeg&desc=The server for foo&unix&dir&webmin&web&dns&mail&limits-from-plan&json=1
Thu, 01/13/2011 - 09:49
andreychek

Howdy,

Your syntax actually works for me... I logged into a test server, and ran this:

wget --no-check-certificate --http-user=root --http-passwd=password 'https://localhost:10000/virtual-server/remote.cgi?program=create-domain&domain=foo.com&pass=smeg&desc=The server for foo&unix&dir&webmin&web&dns&mail&limits-from-plan'

It sits there for a few moments while creating the account... after which, I can go into Virtualmin and see "foo.com" in the UI.

So it actually does sound like it thinks that domain already exists on your system for some reason. It may have been there before and not been completely removed, for example. One thought would be to see if other domains work for you.

-Eric

Thu, 01/13/2011 - 10:39
dwdcweb

I am actually using the php curl module and from what I know there is no way it will cause it to run twice.

function callRPC() {
$url = "https://localhost:10000/virtual-server/remote.cgi?program=create-domain&domain=foo.com&pass=smeg&desc=The server for foo&unix&dir&webmin&web&dns&mail&limits-from-plan&json=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, "root:rootisoverrated");
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec ($ch);
curl_close ($ch);
return $result;
}
Thu, 01/13/2011 - 10:47
andreychek

Sorry, I'm not sure what might cause that :-)

Your code seems correct. However, if it's somehow or another being called twice, that could cause the errors you're seeing.

It does seem to work when being called manually from the command line, so the next step would just be debugging the PHP and the browser is doing in order to determine what's causing the problem you're seeing.

You may want to review the access_log and error_log for that Virtual Server to see if that provides any insight.

-Eric

Thu, 01/13/2011 - 11:12
dwdcweb

hmm! I can try this method:

<?php read_file('http://example.com'); ?>
Thu, 01/13/2011 - 12:54
dwdcweb

did not work as I planned.

Thu, 01/12/2012 - 15:50
yngens

interested in similar solution. subscribing to track

Topic locked