Jump to content

API:Register Domain


Emhope

Recommended Posts

Hi,

 

I'm trying to integrate the WHMCS API with our current system. I am able to add clients through the api but when I try to register a domain I get the following error message "The following error occured: Domain Not Found".

 

I've setup Nominet as my domain registrar. I'm not 100% sure how to test this is working but all of the settings seem correct. I am using the code from this website to interact with the api. Is there something I have missed or failed to setup?

 

I'm not sure if this matters but I don't need whmcs to process the payments as our current system takes care of this. I was hoping I could have whmcs register and point the domain for us and continue to use our system to do the rest.

 

$url = "#/clients/includes/api.php"; # URL to WHMCS API file
$username = "#"; # Admin username goes here
$password = "#"; # Admin password goes here

$postfields["username"] = $username;
$postfields["password"] = md5($password);

$postfields["action"] = "domainregister";
$postfields["domainid"] = "domain.co.uk";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);

$data = explode(";",$data);
foreach ($data AS $temp) {
  $temp = explode("=",$temp);
  $results[$temp[0]] = $temp[1];
}

if ($results["result"]=="success") {
  # Result was OK!
} else {
  # An error occured
  echo "The following error occured: ".$results["message"];
} 

 

Thanks for any help

Link to comment
Share on other sites

  • 9 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated