Searching for existing domain names?

Hello friends,

Domainr API is used to get the information of existing domain names. it is working for all domains ( most probably might not be work for subdomains). using php code we can get the domain is existing or not with reference to domianr API.

 

See the following code to retrieve information

PHP script

 

function getInfo($domain) {
$domain = urlencode($domain); // encode url here...

$request  = "http://domai.nr/api/json/search?";
$request .= "q=".$domain."&";

return $response  = file_get_contents($request);
}

Pass the domain name to that function like : ( without http )

$data=getInfo('www.anillabs.com');

Get the results in the json format and convert into string:

$obj = json_decode($data);
echo "This domain is ".$obj->{'results'}[0]->{'availability'} ;

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *