bool checkdnsrr(string host, [string type]) 
host Hostname or IP address to check
type Type of record for which to check

Checks for DNS resource records for the given host.


TRUE if a record can be found; FALSE on error


Performs a DNS lookup on the specified host (either a hostname or IP address) and returns TRUE if a record of the specified type is found. This function can look up the following record types:

Record Type Details
A Address: Defined in RFC 1035.
ALL Any of the valid types.
CNAME Canonical Name: Defined in RFC 1035.
MX Mail Exchanger: Defined in RFC 1035.
NS Name Server: Defined in RFC 1035.
PTR Pointer: Defined in RFC 1035.
SOA Start of Authority: Defined in RFC 1035.

If no record type is specified, ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.