This article illustrates the CHECKDNSRR usage of PHP functions. Share to everyone for your reference, specific as follows:
That's what it says on the php.net:
(PHP 4, PHP 5)
Checkdnsrr-check DNS Records corresponding to a given the Internet host name or IP address
CHECKDNSRR-Check whether it has a DNS record based on a given host name (domain name) or IP address, in fact, verify that it exists.
The Note:this function is now available on Windows platforms.
Note: This function is not supported on the Windows platform
I tried it, and sure enough, the hint didn't have this function.
Here's a hack approach, so that when we do development on windows, we can see the effect!
if (!function_exists (' CHECKDNSRR ')) {
function checkdnsrr ($host, $type = ') {
if (!empty ($host)) {
$type = ( Empty ($type))? ' MX ': $type;
EXEC (' nslookup-type= '. $type. " '. Escapeshellcmd ($host), $result);
$it = new Arrayiterator ($result);
foreach (New Regexiterator ($it, ' ~^ '. $host. ~ ', Regexiterator::get_match) as $result) {
if ($result) {return
true;
}
}} return false;
}
}
Next I'll introduce the parameters:
BOOL CHECKDNSRR (String $host [, String $type = "MX"])
The first parameter we will not say, is the domain name or IP
The second parameter is the resolution type, respectively:
A (address) record is a record of IP addresses for the specified host name (or domain name).
MX record is the specified mail exchange record (default)
The NS record is a record of the specified domain name server, specifying which DNS the domain name will be parsed by.
SOA records are typically used in a secondary DNS server to specify who is the primary server.
The reverse parsing record of the PTR record from the IP point to the domain name
CNAME record alias record
AAAA record is a record pointing to IPv6
A6 Record ditto
The SRV record is the type of resource record that is supported in the DNS server's database and is typically applied to Microsoft's Active Directory settings.
TXT record text information
Any records, all data types
This function is often used by us to detect whether an email is real!
For more information on PHP-related content readers can view the site topics: "PHP operation Office Document tips summary (including word,excel,access,ppt)", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course", "PHP string (string) Summary of usage, Getting Started tutorial on Php+mysql database operations, and summary of common PHP database operations techniques
I hope this article will help you with the PHP program design.