winten Posted July 11, 2013 Share Posted July 11, 2013 Like explained http://docs.whmcs.com/API:Domain_Nameservers I'm using the following code to get name servers. $command = "domaingetnameservers"; $adminuser = "admin"; $values["domainid"] = "7"; $results = localAPI($command,$values,$adminuser); print_r($results); echo $ns1.$ns2.$ns3.$ns4.$ns5; And even $results is: Array ( [result] => success [error] => ) I get every ns1, ns2... empty. How is that so? 0 Quote Link to comment Share on other sites More sharing options...
tatocaster Posted October 10, 2014 Share Posted October 10, 2014 I have an issue , for this code snippet. it doesn't return anything (localAPI), and page freezes white. Could you post anything if you got some tips? thanks 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 10, 2014 Share Posted October 10, 2014 First of all $ns1, $ns2, $ns3, $ns4 and $ns5 for sure are empty variables since everything come from $result like you can see below (it's an example). Array ( [result] => success [ns1] => ns1.infinitycdn.com [ns2] => ns2.infinitycdn.com [ns3] => ns3.infinitycdn.com [ns4] => ns4.infinitycdn.com [ns5] => [error] => ) So you have to make it in this way: $ns1 = $result["ns1"]; $ns2 = $result["ns2"]; $ns3 = $result["ns3"]; $ns4 = $result["ns4"]; $ns5 = $result["ns5"]; Now all your variables contain the nameserver. About your problem please verify that: Domain ID 7 exists Account "admin" exists on your WHMCS and has API access Domain ID 7 has nameservers I have an issue , for this code snippet. it doesn't return anything (localAPI), and page freezes white. Could you post anything if you got some tips? thanks The code posted by tatocaster works. Have you tryed it? 0 Quote Link to comment Share on other sites More sharing options...
tatocaster Posted October 15, 2014 Share Posted October 15, 2014 yeah I know, I'm pretty well in PHP. I did to assign input array elements to new variables. Also there is written that - if you are calling localApi user is optional , but I'm using, different user. which is registered in system as Administrator. also about domainid, I'm taking this dynamically. I did everything what you wrote, but with no success , that's why , i'm posting here. Because of this, I rewrote this functions with my custom queries to select, update db and etc. Can you give me a other clue? Thanks for response 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 15, 2014 Share Posted October 15, 2014 Sadly I don't know why it doesn't work for you. If I simply copy your code and paste it in my WHMCS I assure you that It works. Maybe it could be time to open a ticket. 0 Quote Link to comment Share on other sites More sharing options...
tatocaster Posted October 15, 2014 Share Posted October 15, 2014 OK, Thanks for your time. 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.