Mega Code Archive

 
Categories / Php / DNS
 

Performing DNS Lookups

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.rntsoft.com" ); echo "IP = $ip\n"; $host = gethostbyaddr ( "192.0.34.166" ); echo "Host = $host\n"; $ip = gethostbynamel ( "yahoo.com" ); print_r ( $ip ); ?>