Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

checkdnsrr

This simply tells us if a particular DNS record was found, so could be useful to see if an entered hostname was valid within an email check.

checkdnsrr -- Check DNS records corresponding to a given Internet host name or IP address
$check=checkdnsrr("hostname", "A");

Let us assume a couple of entries, the first being the valid smirkingloon.com, the second being the invalid liamdelahuntyy.com (extra y)

Results:

$check=checkdnsrr("smirkingloon.com", "A");

Check:

$check=checkdnsrr("liamdelahuntyy.com", "A");

Check:

Notice the later domain fails and doesn't return a value

See also gethostbyaddr, and Ban Access from an IP address with PHP

Share this!