In PHP, there is a CHECKDNSRR function in the system function that checks whether it has a DNS record based on a given host name (domain name) or IP address, in order to verify that it is real. However, this function can only be used under Linux systems and does not support Windows platforms. The following is a collection of online hack method, the implementation of the window platform simulation 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;
}
}
Next I'll 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 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
Articles that you may be interested in
- How PHP uses the filter function to verify mailboxes, URLs, and IP addresses
- PHP Gets the function of the first letter of Chinese pinyin (really can be used)
- Sphinx installed using Windows [support Chinese Full-text Search]
- PHP judgment function, class, class method exists
- PHP uses the Session_set_save_handler () function to save session to MySQL database
- Master-Slave synchronous backup steps of MySQL database in Windows environment
- A program in which PHP gets all the files in the directory and saves the results to an array
- PHP Analog get_headers function