screen_anchor Posted April 21, 2015 Share Posted April 21, 2015 Hi, Im trying to integrate cloudns on whmcs. So here is the process I want to achieve. Suppose I have these dns zones on cloudns: 1. concert.ph 2. show.ph 3. artist.ph And on whmcs I have this subdomain : 1. paul.concert.ph This subdomain will add a new NS record under concert.ph zone on cloudns like : paul.concert.ph NS ns1.test.com And that NS record can be edited on whmcs and will be reflected on cloudns. ===================================================== And my Custom Whmcs Cloudns Module code is : <?php function cloudns_getConfigArray() { $configarray = array( "AuthID" => array( "Type" => "text", "Size" => "20", "Description" => "Enter your API ID here", ), "AuthPass" => array( "Type" => "password", "Size" => "20", "Description" => "Enter your API Password here", ), ); return $configarray; } function apiCall($url, $data, $params) { $AI = $params["AuthID"]; $AP = $params["AuthPass"]; /*Test Match Whmcs param to cloudns api param*/ $authid = $AI; $authpassword = $AP; $url = 'https://api.cloudns.net/'. $url; /*I want to use the match whmcs/cloudns params here*/ $data = '&auth-id='.$authid.'&auth-password='.$authpassword.'&'. $data; $init = curl_init(); curl_setopt($init, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($init, CURLOPT_RETURNTRANSFER, true); curl_setopt($init, CURLOPT_URL, $url); curl_setopt($init, CURLOPT_POST, true); curl_setopt($init, CURLOPT_POSTFIELDS, $data); $content = curl_exec($init); curl_close($init); return json_decode($content, true); } function cloudns_GetNameservers($params) { $tld = $params["tld"]; $sld = $params["sld"]; # Put your code to get the nameservers here and return the values below $values["ns1"] = $nameserver1; $values["ns2"] = $nameserver2; $values["ns3"] = $nameserver3; $values["ns4"] = $nameserver4; $connect = apiCall('dns/add-record.json', 'domain-name=',$tld,'&record-type=',NS,'&host=',$sld,'&record=',$values["ns1"],'&ttl=',3600); $connect = apiCall('dns/add-record.json', 'domain-name=',$tld,'&record-type=',NS,'&host=',$sld,'&record=',$values["ns2"],'&ttl=',3600); $connect = apiCall('dns/add-record.json', 'domain-name=',$tld,'&record-type=',NS,'&host=',$sld,'&record=',$values["ns3"],'&ttl=',3600); $connect = apiCall('dns/add-record.json', 'domain-name=',$tld,'&record-type=',NS,'&host=',$sld,'&record=',$values["ns4"],'&ttl=',3600); # If error, return the error message in the value below if (isset($connect['status']) && $connect['status'] == 'Failed') { $values["error"] = $error; } return $values; } function cloudns_SaveNameservers($params) { $tld = $params["tld"]; $sld = $params["sld"]; $nameserver1 = $params["ns1"]; $nameserver2 = $params["ns2"]; $nameserver3 = $params["ns3"]; $nameserver4 = $params["ns4"]; # Put your code to save the nameservers here $connect = apiCall('dns/mod-record.json', 'domain-name=',$tld,'&record-id=',1101257,'&host=',$sld,'&record=',$nameserver1,'&ttl=',3600); $connect = apiCall('dns/mod-record.json', 'domain-name=',$tld,'&record-id=',1101257,'&host=',$sld,'&record=',$nameserver2,'&ttl=',3600); $connect = apiCall('dns/mod-record.json', 'domain-name=',$tld,'&record-id=',1101257,'&host=',$sld,'&record=',$nameserver3,'&ttl=',3600); $connect = apiCall('dns/mod-record.json', 'domain-name=',$tld,'&record-id=',1101257,'&host=',$sld,'&record=',$nameserver4,'&ttl=',3600); # If error, return the error message in the value below // This method returns array with Status and StatusDescription, the Statuses are Failed i Success if (isset($connect['status']) && $connect['status'] == 'Failed') { $values["error"] = $error; } return $values; } ?> =================================================================================== Unfortunately there is no ns record added in cloudns but I have a successful saved ns on whmcs client area. Please check my code if I miss something to make my custom module work. Cloudns API can be found here : https://asia.cloudns.net/api-help/records/add-record-domain-zone/ Please advise. Many Thanks. 0 Quote Link to comment Share on other sites More sharing options...
doublet Posted May 13, 2015 Share Posted May 13, 2015 Hi, I'm not a programmer so can't help you, but I found this thread very interesting. Any news with this ? thanks 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.