dns_loop()


Returns a response from the DNS server

Description

string dns_loop(void)

Parameters

none

Return Value

On success IP address, On fail null string(""), when didn't receive DNS response returns false

Example

<?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 domain name
    break;
  }
  else
  {
    echo "$rr\r\n";          // outputting DNS server's response
    break;
  }
}
?>

See also