Sample code for 30+ languages & platforms
PHP ActiveX

DNS Lookup

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

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

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

$socket = new COM("Chilkat.Socket");

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

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

?>