gethostbynamel

array gethostbynamel(string hostname) 

Gets multiple IP addresses for an Internet host.

Returns:

Array of IP addresses

Description:

gethostbynamel() performs a DNS lookup of an Internet hostname and returns a list of corresponding IP addresses. This is useful for Web sites that use “round-robin DNS”—a form of load-balancing whereby one domain name resolves to multiple IP addresses. If no IP address can be found for the specified hostname, the function returns an empty array.

Availability:

UNIX, Windows

Version:

3+, 4+

See also:

gethostbyaddr() 
gethostbyname() 

Example:

23.7. Find the IP addresses for a hostname
 <?php $host = 'www.w3c.org'; $ips = gethostbynamel ($host); if (0 == count ($ips)) { echo "I could not successfully ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.