注意 This function is not implemented on Windows platforms.
Returns an array of associative arrays. Each associative array contains at minimum the following keys: host, type, class, ttl.
注意 'class' key will always be "IN" indicating an IPv4 resource record.
注意 'ttl' key will contain the TTL remaining since the last time the local nameserver queried the authoritative name server.
hostname should be a valid DNS hostname such as "www.example.com". Reverse lookups can be generated using in-addr.arpa notation, but gethostbyaddr() is more suitable for the majority of reverse lookups.
By default, dns_get_record() will search for any resource records associated with hostname. To limit the query, specify the optional type parameter. type may be any one of the following: DNS_A, DNS_CNAME, DNS_HINFO, DNS_MX, DNS_NS, DNS_PTR, DNS_SOA, DNS_TXT, DNS_ALL or DNS_ANY. The default is DNS_ANY.
注意 Because of excentricities in the performance of libresolv between platforms, DNS_ANY will not always return every record, the slower DNS_ALL will collect all records more reliably.
The optional third and fourth arguments to this function, authns and addtl are passed by reference and, if given, will be populated with Resource Records for the Authoritative Name Servers, and any Additional Records respectively. See the example below.
SOA records are the largest of the returned types. 'mname' contains the name of the machine from which the resource records originated. 'rname' is the email address of the administrative contact for this zone. 'serial', 'refresh', 'retry', 'expire', and 'minimum-ttl' give the traditional SOA zone values one would expect.
注意 Per DNS standards, email addresses are given in user.host format (for example: hostmaster.example.com as opposed to hostmaster@example.com), be sure to check this value and modify if necessary before using it with a functions such as mail().
A records will contain an 'ip' key providing their IPv4 address.
MX records will conatin a 'pri' key indicating priority (preference). It will also have a 'target' key which lists the FQDN of the mail exchanger. See also dns_get_mx().
CNAME, NS, and PTR records will each contain a 'target' key giving the particular location in the DNS namespace which they refer to.
TXT records will have a 'txt' key containing the text data associated with the named resource record.
HINFO records have two parameters: 'cpu' and 'os' which describe the opperating environment of the specified host. The values are given as integers, see RFC 1010 for the meaning of these values.
Since it's very common to want the IP address of a mail server once the MX record has been resolved, dns_get_record() also returns an array in addtl which contains associate records. authns is returned as well conatining a list of authoritative name servers.
例 2dns_get_record()の例
|
dns_get_mx(), および dns_check_record()も参照してください。