Net_DNS always failing. Try this code and see
Posted: Tue Oct 12, 2004 6:34 am
I'm trying to get the Pear Net_DNS funtion to work, but no matter what code I use it always returns a failure. The PHP is as follows
When I call this from a browser the page displays the following
I presume that if I'm getting this much then the class is installed correctly, but does anyone have any idea what I'm doing wrong? Is anyone getting the same result?
I'm not totally fluent at PHP, so don't assume too much.
Thanks
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