Phpwindow platform simulates the checkdnsrr function to check whether the email actually exists _ PHP Tutorial

Source: Internet
Author: User
Tags mail exchange mx record to domain
The phpwindow platform simulates the checkdnsrr function to check whether the email actually exists. There is a checkdnsrr function in the php system function. This function is used to check whether a DNS record exists based on a given hostname or IP address, the purpose is to check whether there is a checkdnsrr function in the php system function. the function is used to check whether a DNS record exists based on a given host name or IP address, the purpose is to check whether it actually exists. However, this function can only be used in linux and does not support windows. The following is a hack method collected on the internet. it simulates the checkdnsrr function on the window platform to check whether an email exists!

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 will introduce the parameters of this function:

Bool checkdnsrr (string $ host [, string $ type = "MX"])

The first parameter is the domain name or ip address.

The second parameter is the resolution type, which includes:

The A (Address) record is the IP Address record corresponding to the specified host name (or domain name.

MX record is the specified mail exchange record (default)

An NS record is a record of a domain name server. it specifies the DNS to which the domain name is resolved.

SOA records are generally used in secondary dns servers to specify who is the primary server.

PTR record reverse resolution record pointing from ip to domain name

CNAME record alias record

The AAAA record is a record pointing to IPv6.

A6 record is the same as above

The SRV record is a type of resource record supported by the database of the DNS server. it is generally used when setting the Active Directory of Microsoft.

TXT records text information

ANY records, all data types

Articles you may be interested in
  • Php uses the filter function to verify the mailbox, url, and IP address
  • Php function for getting the first letter of Chinese characters and pinyin (actually usable)
  • Install and use Sphinx in windows [Chinese full-text search is supported]
  • Php checks whether functions, classes, and class methods exist.
  • Simulate the get_headers function in php.
  • Php obtains all the files in the directory and saves the results to the array program.
  • Steps for synchronizing and backing up mysql databases in windows
  • Common JS function Collection (remove spaces, verify email addresses, dates, positive integers, etc)

Your name (domain name) or IP address check whether it has a DNS record, the purpose is to check whether it is...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.