Sending DNS query to designated DSN server IP address
int dns_send_query(string $name, int $type)
the length of query on success, 0 on fail
<?php
include "/lib/sn_dns.php";
$rr = "";
$name = "www.phpoc.com";
dns_setup(0); // UDP ID 0, and system DSN server IP addesss
dns_send_query($name, RR_A); // sending query for www.phpoc.com
while(1)
{
$rr = dns_loop(); // receiving response from the DNS server
if($rr === false)
usleep(1000);
elseif($rr == "")
{
echo $name, "r\r\n"; // outputting host name
break;
}
else
{
echo "$rr\r\n"; // outputting DNS server's response
break;
}
}
?>