Mega Code Archive

 
Categories / Php / DNS
 

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); ?>