GETHOSTBYNAME(3) 1 GETHOSTBYNAME(3)
gethostbyname - Get the IPv4 address corresponding to a given Internet host name
SYNOPSIS
string gethostbyname (string $hostname)
DESCRIPTION
Returns the IPv4 address of the Internet host specified by $hostname.
PARAMETERS
o $hostname
- The host name.
RETURN VALUES
Returns the IPv4 address or a string containing the unmodified $hostname on failure.
EXAMPLES
Example #1
A simple gethostbyname(3) example
<?php
$ip = gethostbyname('www.example.com');
echo $ip;
?>
SEE ALSO
gethostbyaddr(3), gethostbynamel(3), inet_pton(3), inet_ntop(3).
PHP Documentation Group GETHOSTBYNAME(3)