Wednesday, March 26, 2014

check domain name availability with httpapi php

3/26/2014


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 ""; } ?>

helpful? Share this

The Editorial Team of 4everTutorials consists of a group of PHP Professionals.

5 comments:

Anonymous said...

Its like you read my mind! You appear to know so much about this, like you wrote
the book in it or something. I think that you can do with some pics to drive the
message home a little bit, but instead of that, this is
great blog. An excellent read. I'll certainly be back.


my web site - sterling silver

Anonymous said...

Hey very nice web site!! Guy .. Excellent ..
Amazing .. I will bookmark your blog and take the feeds additionally?
I am satisfied to find a lot of helpful information right
here in the put up, we need develop extra strategies on this regard, thank you for sharing.
. . . . .

my web blog - silver jewelry wrapped

Anonymous said...

Thanks for your personal marvelous posting! I truly enjoyed
reading it, you're a great author. I will make sure to bookmark your blog and definitely will come back from
now on. I want to encourage you to continue your great writing, have a nice day!


Feel free to visit my site: baterai notebook

Anonymous said...

this code is not working.. i exactly copied ur code and edited my id and key.. but it returns a blank page..

Web master said...

you can run this script on your local server, for this enter your ip address in api settings. AND in code use https://test.httpapi.com URL for api request. thanks

 

© 2014 4everTutorials. All rights resevered.

Back To Top