gethostbyname
reactphp/event-loop
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the IPv4 address corresponding to a given Internet host name
gethostbyname
(
string $hostname
):
string
$ip
=
gethostbyname
(
'www.google.com'
);
if (
ip2long
(
$ip
) ===
false
) {
echo
'Unable to resolve hostname'
.
PHP_EOL
;
exit(
1
);
examples/14-http-client-async.php