Skip to main content

root pass and host for xmlapi.php variables?

Comments

2 comments

  • cPanelLauren
    This is pretty straight forward: root_pass is the root password for the server remote_host is the ip address/hostname of the server you're attempting to add the account on domain is the name of the domain you're attempting to add I do want to point out that this is an obsolete and no longer updated script as noted in the GIT repository homepage here CpanelInc/xmlapi-php
    0
  • cPanelTJ
    Booo, A more secure and preferred method would be to use our API Token. It would look something like this: [CODE=php] $user = "root"; $token = "MYAPITOKEN"; $query = "https://127.0.0.1:2087/json-api/createacct?api.version=1&username=USERNAME&domain=DOMAIN"; $curl = curl_init(); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $header[0] = "Authorization: whm $user:$token"; curl_setopt($curl,CURLOPT_HTTPHEADER,$header); curl_setopt($curl, CURLOPT_URL, $query); $result = curl_exec($curl); $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($http_status != 200) { echo "[!] Error: " . $http_status . " returned\n"; } else { $json = json_decode($result); echo $json->{'metadata'}->{'reason'}; } curl_close($curl); ?>
    0

Please sign in to leave a comment.