Wednesday, January 9, 2013

Check Domain Name Using Php Script

We can check our DNS record to verify the existence of a domain name or not. We can see if facebook.com is there in DNS record by using checkdnsrr function. This function returns True if available and returns False if not available.The type can be A, MX, NS, PTR,SOA, AAAA, CNAME, SRV,A6 NAPTR, TXT or ANY.




Here is the simple code to check DNS records.

$domain="facebook.com";
if(!checkdnsrr($domain,'MX')) {
echo "Not there ";
}else {
echo " It is there "; }
 
//out put: It is there 

 

No comments:

Post a Comment

Thanks....