Check for Existence of DNS Records - checkdnsrr()

The Domain Name System (DNS) is what allows you to use domain names (e.g., in place of the corresponding IP address, such as The domain names and their complementary IP addresses are stored on domain name servers, which are interspersed across the globe.

Typically, a domain has several types of records associated to it, one mapping the IP address to the domain, another for directing e-mail, and another for a domain name alias.

The checkdnsrr() function checks for the existence of DNS records. DNS records are checked based on the supplied host value and optional DNS resource record type, returning TRUE if any records are located and FALSE otherwise.

For example,

$recordexists = checkdnsrr("", "ANY");
if ($recordexists)
echo "The domain name exists!";
echo "The domain name does not appear to exist!";

 You can also use this function to verify the existence of a domain of a supplied mail address.