PHP dns_check_record() Function

❮ PHP Network Reference

Example

Check DNS records:

<?php
$domain="w3schools.com";
if(dns_check_record($domain,"MX")) {
  echo "Passed";
} else {
  echo "Failed";
}
?>


Definition and Usage

The dns_check_record() function is an alias of the checkdnsrr() function.

Syntax

dns_check_record(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:
  • A
  • MX (default)
  • NS
  • SOA
  • PTR
  • CNAME
  • AAAA
  • A6
  • SRV
  • NAPTR
  • TXT
  • ANY


Technical Details

Return Value: TRUE if any records are found, FALSE otherwise
PHP Version: 5.0+

❮ PHP Network Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.