Check if a domain is Registered with PHP

来源:互联网 时间:1970-01-01

Today I would like to share a very simple PHP code snippet that lets you know if a given specific domain is registered or available for purchase or not.To check if a domain is registered or not we will use the PHP’s built in function called checkdnsrr().This function searches for the DNS records of the given domain and if they are not available that means the domain is not registered and it is available.

Here is a simple script that you can use:

<?php

function is_domain_available ( $domain ) {

return checkdnsrr ( $domain , 'ANY' ) ? $domain . ' is already registered' : $domain . ' is available' ;

}

// how to use :

$domain = 'arjunphp.com' ;

echo is_domain_available ( $domain ) ;

?>

Output is arjunphp.com is already registered. just you need to pass the domain name to the function.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

相关阅读:
Top