In this post we explain you that how you can check domain name availability using httpapi.com api with php and returns domain name availability status for the requested TLDs. It requires GET HTTP Method. You need following parameters:
auth-userid => your reseller id
api-key or auth-password => your api code / account password
domain-name => Array of Strings - that you need to check the availability for
tlds => Array of Strings - TLDs for which the domain name availability needs to be checked
suggest-alternative (optional) => pass "true" if domain name suggestions are required. Default value is false.
After api call, you will be get the below details in response:
Domain Availability Status (status)
available - domain name available for registration
regthroughus - domain name currently registered through the Registrar whose connection is being used to check the availability of the domain name
regthroughothers - domain name currently registered through a Registrar other than the one whose connection is being used to check the availability of the domain name. If you wish to manage such a domain name through your Reseller / Registrar Account, you may pass a Domain Transfer API call
unknown - returned, if for some reason, the Registry connections are not available. You should ideally re-check the domain name availability after some time.
For API Call, you can use following php function.
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ function Check_Domains() { # API Url: for test=>https://test.httpapi.com , for live=>https://httpapi.com $api_url = 'https://test.httpapi.com'; $auth_userid = ''; // reseller unique id $api_key = ''; // api-key or reseller password $domainname1 = 'enter any keyword without space'; // first domain name (example: google) $domainname2 = 'keyword2'; // second domain name (example: facebook) // top level domains $tld1 = 'com'; $tld2 = 'net'; $check_domains = $api_url.'/api/domains/available.json?auth-userid='.$auth_userid.'&api-key='.$api_key.'domain-name='.$domainname1.'&domain-name='.$domainname2.'&tlds='.$tld1.'&tlds='.$tld2; $result = @file_get_contents($check_domains); $response = json_decode($result, true); if($response) { return $response; } else { return false; } } ?>
Function USAGE
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $_details = Check_Domains(); if($_details) { echo ""; print_r($_details); echo ""; } else { echo ""; } ?>