In PHP's system functions, there is a CHECKDNSRR function that checks whether it has a DNS record based on a given host name (domain name) or IP address to verify that it exists. However, this function can only be used under Linux systems and does not support the Windows platform. The following is an online collection of a hack method, the implementation of the window platform to simulate the CHECKDNSRR function to detect the existence of an email function!
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; }}
Let me now introduce the parameters of the function:
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 parse type, respectively:
A (address) record is the IP address record that corresponds to the specified hostname (or domain name).
MX record is a specified mail exchange record (default)
The NS record is the record of the specified domain name server, specifying which DNS the domain name is to be parsed.
SOA records are typically used in a secondary DNS server to designate who is the primary server.
PTR records reverse parsing records from IP to domain name
CNAME record alias record
AAAA record is a record pointing to IPv6
A6 Record Ibid.
SRV records It is a 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 any records, all data types
Articles you may be interested in
- Php method for verifying mailboxes, URLs, and IP addresses using the filter function
- PHP to get the first letter of Chinese pinyin function (really can use)
- Sphinx installation under Windows [Support Chinese full text Search]
- PHP judgment function, class, class method exists
- PHP Simulation get_headers function
- PHP gets all the files in the directory and saves the results to an array of programs
- Master-Slave synchronous backup steps for MySQL database in Windows environment
- JS Common function Collection (remove space, verify mailbox, date, positive integer, etc.)
http://www.bkjia.com/PHPjc/813353.html www.bkjia.com true http://www.bkjia.com/PHPjc/813353.html techarticle in the PHP system function, there is a CHECKDNSRR function, the function is to check whether it has a DNS record based on a given host name (domain name) or IP address, to verify that it is ...