Code: Select all
<?php
require 'Net/DNS.php';
$D = new Net_DNS();
$D->resolver->debug = 1;
$result = $D->resolver->query('viebrock.ca');
if ( $result->header->rcode != 'NOERROR' && $result->header->ancount > 0 )
{
echo $result->answer[0]->address;
}
else
{
echo 'Problem';
}
?>Code: Select all
;; query(viebrock.ca, A, IN) ;; HEADER SECTION ;; id = 3268 ;; 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) ;; viebrock.ca. IN A ;; ANSWER SECTION (0 records) ;; AUTHORITY SECTION (0 records) ;; ADDITIONAL SECTION (0 records) ;; using simple sockets ProblemI'm not totally fluent at PHP, so don't assume too much.
Thanks