dns_send_query()


向指定域名传送DNS查询

Description

int dns_send_query(string $name, int $type)

Parameters

Return Value

成功时传送查询的大小(字节 数),失败时为0

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

See also