checkdnsrr in PHP

Syntax of checkdnsrr

bool checkdnsrr(string host[, string type])

Searches DNS records for a host having the given type. Returns true if any records are found, and false if none are found. The host type can take any of the following values (if no value is specified, MX is the default):

AIP address
MX (default)Mail exchanger
NSName server
SOAStart of authority.
PTRPointer to information
CNAMECanonical name
AAAA128-bit IPv6 address
A6Defined as part of early IPv6 but downgraded to experimental.
SRVGeneralized service location record.
NAPTRRegular expression based rewriting of domain names.
TXTOriginally for human-readable text. However, this record also carries machine-readable data
ANYAny of the above

Example of checkdnsrr in PHP

<?php
$domain="codingtube.tech";
if(checkdnsrr($domain,"MX")) {
  echo "Passed";
} else {
  echo "Failed";
}
?>

Leave a Comment