dns_lookup()


Returns a response from the DNS server after sending DNS query to designated DSN server IP address

Description

string dns_lookup(string $name, int $type)

Parameters

Return Value

On success IP address, otherwise input host name

Example

<?php
include "/lib/sn_dns.php";
dns_setup(0);   // UDP 0
$host_name = "www.phpoc.com";
$host_addr = dns_lookup($host_name, RR_A); // sending query for www.phpoc.com
if($host_addr == $host_name)
  echo "$host_name: Not Found\r\n";        // on fail
else
  echo "$host_name: $host_addr\r\n";       // on sucess, output host's IP address
?>

See also