| How to perform an Inverse Query (PTR query):
require_once("Net/DNS.php");
$res = new Net_DNS_Resolver();
$res->debug = 1;
$answer = $res->search("66.57.24.174");
echo "<BR><HR><BR>";
print_r($answer);
This example will query the name server and output the following:
;; search(174.24.57.66.in-addr.arpa, PTR, IN)
;; query(174.24.57.66.in-addr.arpa, PTR, IN)
;; HEADER SECTION
;; id = 43010
;; qr = 0 opcode = QUERY aa = 0 tc = 0 rd = 1
;; ra = 0 rcode = NOERROR
;; qdcount = 1 ancount = 0 nscount = 0 arcount = 0
;; QUESTION SECTION (1 record)
;; 174.24.57.66.in-addr.arpa. IN PTR
;; ANSWER SECTION (0 records)
;; AUTHORITY SECTION (0 records)
;; ADDITIONAL SECTION (0 records)
;; using extended PHP sockets
;; send_udp(209.170.128.70:53): sending 43 bytes
;; timeout set to 5 seconds
;; answer from 209.170.128.70:53: 90 bytes
;; HEADER SECTION
;; id = 43010
;; qr = 1 opcode = QUERY aa = 0 tc = 0 rd = 1
;; ra = 1 rcode = NOERROR
;; qdcount = 1 ancount = 1 nscount = 0 arcount = 0
;; QUESTION SECTION (1 record)
;;
;174.24.57.66.in-addr.arpa. IN PTR
;; ANSWER SECTION (1 record)
174.24.57.66.in-addr.arpa. 86400 IN PTR cpe-066-057-024-174.nc.res.rr.com
;; AUTHORITY SECTION (0 records)
;; ADDITIONAL SECTION (0 records)
net_dns_packet Object
(
[debug] => 1
[header] => net_dns_header Object
(
[id] => 43010
[qr] => 1
[opcode] => QUERY
[aa] => 0
[tc] => 0
[rd] => 1
[ra] => 1
[rcode] => NOERROR
[qdcount] => 1
[ancount] => 1
[nscount] => 0
[arcount] => 0
)
[compnames] => Array
(
)
[answerfrom] => 209.170.128.70
[answersize] => 90
[question] => Array
(
[0] => net_dns_question Object
(
[qname] => 174.24.57.66.in-addr.arpa
[qtype] => PTR
[qclass] => IN
)
)
[answer] => Array
(
[0] => net_dns_rr_ptr Object
(
[name] => 174.24.57.66.in-addr.arpa
[type] => PTR
[class] => IN
[ttl] => 86400
[rdlength] => 35
[rdata] => cpe-066-057-024-174ncresrrcom
[ptrdname] => cpe-066-057-024-174.nc.res.rr.com
)
)
[authority] => Array
(
)
[additional] => Array
(
)
)
|