Need a basic example of working with cPanel's XML API PHP Class
Well I've search high and low and still cant get any result. I am trying to create an addon domain (I have a shared hosting account) this sample code is from github I would appreciate it if someone could explain this code line by line.
[PHP]password_auth("root",$root_pass);
$xmlapi->set_http_client('curl');
$xmlapi->set_port(2086);
$xmlapi->set_debug(1);
print $xmlapi->adddns($domain,$ip);
?>[/PHP]
-
include '../xmlapi.php'; // Includes the xml api support $ip = getenv('REMOTE_HOST'); //set IP to whatever your REMOTE_HOST is ... this should be your cpanel server's ip $root_pass = getenv('REMOTE_PASSWORD'); // root password for cpanel server $domain = "somedns.com"; // domain to add $xmlapi = new xmlapi($ip); //creates a new xmlapi call specified to the ip address you gave it $xmlapi->password_auth("root",$root_pass); //sets login info - we have to validate you before we can run api calls $xmlapi->set_http_client('curl'); //??? - same as linux client? someone else might be able to clarify further $xmlapi->set_port(2086); //default WHM non-ssl port $xmlapi->set_debug(1); // i don't know if you need this print $xmlapi->adddns($domain,$ip); //i believe what runs the call
Additionally here is the documentation link for our API:0
Please sign in to leave a comment.
Comments
1 comment