Sample code for 30+ languages & platforms
PHP Extension

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

$socket = new CkSocket();

$maxWaitMs = 10000;
$ipAddr = $socket->dnsLookup('www.chilkatsoft.com',$maxWaitMs);
if ($socket->get_LastMethodSuccess() != true) {
    print $socket->lastErrorText() . "\n";
    exit;
}

print 'IP Address: ' . $ipAddr . "\n";

?>