DNS Lookup Functions : DNS Functions « DNS « PHP






DNS Lookup Functions

 
Name                   Description

gethostbyname()        Gets IP address corresponding to the hostname

gethostbynamel()       Gets list of IP addresses corresponding to the hostname

gethostbyaddr()        Gets hostname corresponding to an IP address

getmxrr()                Fetches the mail exchange (MX) record associated with a hostname

dns_get_mx()             Alias for getmxrr()

checkdnsrr()             Checks for the existence of DNS records for a hostname

dns_check_record()       Alias for checkdnsrr()

dns_get_record()         Fetches DNS records associated with a hostname

<?php
$ip = gethostbyname("www.example.com");
echo "IP = $ip\n";
$host = gethostbyaddr("192.0.34.166");
echo "Host = $host\n";
$ip = gethostbynamel("yahoo.com");
print_r($ip);
?>
  
  








Related examples in the same category

1.DNS Record Types and Their Meanings
2.Using the dns_check_record() Function
3.Fetches DNS records associated with a hostname
4.Performing DNS Lookups