返回值

这个函数返回一个关联数组，如果失败则 或者在失败时返回 FALSE。每个关联数组都至少包含了以下的这些键。
at minimum the following keys:

Basic DNS attributes

Attribute

Meaning

host

The record in the DNS namespace to which the rest of the associated data refers.

class

dns_get_record() only returns Internet class records and as
such this parameter will always return IN.

type

String containing the record type. Additional attributes will also be contained
in the resulting array dependant on the value of type. See table below.

ttl

"Time To Live" remaining for this record. This will not equal
the record's original ttl, but will rather equal the original ttl minus whatever
length of time has passed since the authoritative name server was queried.

target: FQDN of location in DNS namespace to which
the record is aliased.

NS

target: FQDN of the name server which is authoritative
for this hostname.

PTR

target: Location within the DNS namespace to which
this record points.

TXT

txt: Arbitrary string data associated with this record.

HINFO

cpu: IANA number designating the CPU of the machine
referenced by this record.
os: IANA number designating the Operating System on
the machine referenced by this record.
See IANA's » Operating System
Names for the meaning of these values.

SOA

mname: FQDN of the machine from which the resource
records originated.
rname: Email address of the administrative contain
for this domain.
serial: Serial # of this revision of the requested
domain.
refresh: Refresh interval (seconds) secondary name
servers should use when updating remote copies of this domain.
retry: Length of time (seconds) to wait after a
failed refresh before making a second attempt.
expire: Maximum length of time (seconds) a secondary
DNS server should retain remote copies of the zone data without a
successful refresh before discarding.
minimum-ttl: Minimum length of time (seconds) a
client can continue to use a DNS resolution before it should request
a new resolution from the server. Can be overridden by individual
resource records.

AAAA

ipv6: IPv6 address

A6(PHP >= 5.1.0)

masklen: Length (in bits) to inherit from the target
specified by chain.
ipv6: Address for this specific record to merge with
chain.
chain: Parent record to merge with
ipv6 data.

SRV

pri: (Priority) lowest priorities should be used first.
weight: Ranking to weight which of commonly prioritized
targets should be chosen at random.
target and port: hostname and port
where the requested service can be found.
For additional information see: » RFC 2782

NAPTR

order and pref: Equivalent to
pri and weight above.
flags, services, regex,
and replacement: Parameters as defined by
» RFC 2915.

Get more than one type at once like this:<?php$dnsr = dns_get_record('php.net', DNS_A + DNS_NS);print_r($dnsr);?>

Using DNS_ALL fails on some domains where DNS_ANY works. I noticed the function getting stuck on the DNS_PTR record, which caused it to return FALSE with this error:PHP Warning: dns_get_record(): res_nsend() failed in ....

Please note that Firewalls and anti malware software detects (and depending on company policies even blocks) DNS_ANY requests. In that case the usage of this function fails.This is because DNS_ANY requests can be exploited for creating "amplification (D)DOS attackes": You send 1 DNS_ANY request and get a huge amount of information back, thus even small requests can result into hugh network load.

I advise to use a more explicit name-request instead of using DNS_ANY.