These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Remote.cgi and creating domain issue? on the new forum.
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
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
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;
}
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
hmm! I can try this method:
<?php read_file('http://example.com'); ?>
did not work as I planned.
interested in similar solution. subscribing to track