Hello, i want to integrate cPanel & WHM with my own commercial billing software and i got a problem on some domains, example.com domain and subdomains are working, but others got the following error (statusmsg):
I currently use this code for account creation:
(all variables are set correctly)
What is the problem? I tried also on other cPanel web server and i got same statusmsg.
Code:
(XID 3h75kx) The system failed to find IPv4 addresses for “a.gtld-servers.net”, “b.gtld-servers.net”, “c.gtld-servers.net”, “d.gtld-servers.net”, “e.gtld-servers.net”, “f.gtld-servers.net”, “g.gtld-servers.net”, “h.gtld-servers.net”, “i.gtld-servers.net”, “j.gtld-servers.net”, “k.gtld-servers.net”, “l.gtld-servers.net”, and “m.gtld-servers.net”. Because of this, the system cannot find “valmhost.com”’s authoritative nameservers. See the cPanel & WHM error log for more details.
Code:
function cpanel_createUser($whm_user, $whm_pass, $accountarray = null, $host = 'localhost', $returnJSON = 1) {
// Don't touch this stuff
$acc_username = $accountarray['username'];
$acc_pass = $accountarray['password'];
$acc_plan = $accountarray['plan'];
$acc_email = $accountarray['email'];
$acc_domain = $accountarray['domain'];
$acc_reseller = $accountarray['reseller'];
$url = "https://$host:2087/json-api/createacct?username=$acc_username&plan=$acc_plan&domain=";
$url .= urlencode($acc_domain) . "&password=" . urlencode($acc_pass). "&reseller=" . urlencode($acc_reseller);
$url .="&email=" . urlencode($acc_email);
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_HEADER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_USERPWD, $whm_user.":".$whm_pass);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($curl, CURLOPT_URL, $url);
$curl_response = curl_exec($curl);
if($returnJSON == 1) {
return json_decode($curl_response, true); } else { return $curl_response; }
curl_close($curl);
}
$userm = getUserVar($_SESSION['user_id']);
$usern = strtolower($userm['username']);
$usern = preg_replace('/\s+/', '', $usern);
$usern2 = mb_substr($usern, 0, 4);
$usern = 'cp'.rand(1, 99).''.$usern2;
$woDomain = $_SESSION['wo_domain'];
$accountArray = array('username' => $usern, 'password' => random_str(12, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.][%_"), 'plan' => $pkg, 'domain' => $woDomain, 'reseller' => $pro_reseller_p, 'email' => $_SESSION['email']);
$log = cpanel_createUser($whm_root, $whm_pass, $accountArray, $whm_address, 0);
What is the problem? I tried also on other cPanel web server and i got same statusmsg.