PHP
Chilkat2 PHP
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat PHP Downloads
<?php
use Chilkat2\Socket;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$socket = new Socket();
$maxWaitMs = 10000;
try {
$ipAddr = $socket->DnsLookup('www.chilkatsoft.com', $maxWaitMs);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo 'IP Address: ', $ipAddr, "\n";