PHP checkdnsrr() Function
Example
Check DNS records:
<?php
$domain="w3schools.com";
if(checkdnsrr($domain,"MX")) {
echo
"Passed";
} else {
echo "Failed";
}
?>
Definition and Usage
The checkdnsrr() function checks DNS records for type corresponding to host.
We can use the checkdnsrr() function to check our DNS record to verify the existence of a domain name or not.
Syntax
checkdnsrr(host, type)
Parameter Values
Parameter | Description |
---|---|
host | Required. Specifies an IP address or host name to check |
type | Optional. Specifies the type. Can be one of the following:
|
Technical Details
Return Value: | TRUE if any records are found, FALSE otherwise |
---|---|
PHP Version: | 4.0+ |
PHP Changelog: | PHP 5.3: Now available on Windows platforms PHP 5.2.4: Added the TXT value of type |
❮ PHP Network Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.