The dns_check_record() function is an inbuilt function in PHP which is used to check the DNS records corresponding to the hostname or IP address. This function can be used to verify whether a domain name exists or not.
Note: This function is an alias of the checkdnsrr() function.
bool dns_check_record( string $host, string $type )
Parameters: This function accepts two parameters as mentioned above and described below:
- $host: It is required parameter. It specifies the host name or IP address which to be checked.
- $type: It is optional parameter. It specifies the type of DNS record to be checked. Its possible values are: A, AAAA, A6, ANY, CNAME, MX (default), NAPTR, NS, PTR, SOA, SRV, TXT.
Return Value: This function returns TRUE if records found, otherwise returns FALSE.
- This function is available for PHP 4.0.0 and newer version.
- On Windows platforms this function is available from PHP 5.3.0.
Below programs illustrate the dns_check_record() function in PHP:
A:found MX:found NS:found SOA:found PTR:found CNAME:found AAAA:found A6:found SRV:found NAPTR:found TXT:found ANY:found
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.