RE: [PHP-WIN] whois.... ?

From: Date: Fri, 04 Aug 2000 18:24:24 +0000
Subject: RE: [PHP-WIN] whois.... ?
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-1565@lists.php.net to get a copy of this message
I guess the text attachment is stripped before being posted to the group, so am including the text here. It is not a function, just a quickly thrown-together function. You might find it useful. Cheers Shanx ------------------------------------------------ HERE IS THE CODE <?php /*------------------------------------------------ Configure the domain and call the function ------------------------------------------------*/ $mydomain = "bigfoot.com"; validate_domain($mydomain); /*------------------------------------------------ The function.. ------------------------------------------------*/ function validate_domain($domain) { if ($domain) { $fp = fsockopen( "rs.internic.net", 43, &$errno, &$errstr, 10); if (!$fp) { echo "An error occured: $errstr ($errno)<br>\n"; } else { fputs($fp, "$domain\r\n"); while(!feof($fp)) { $buf = fgets($fp,128); if (ereg( "Whois Server:", $buf)) { $server = str_replace( "Whois Server: ", "", $buf); $server = trim($server); } } fclose($fp); } if ($server) { echo "The domain <B>$domain</b> is registered at $server:<p><hr><p>"; echo "<pre>"; $fp = fsockopen($server, 43, &$errno, &$errstr, 10); if(!$fp) { echo "Could not open connection to $server on port 43.\n"; echo "$errstr ($errno)<br>\n"; } else { fputs($fp, "$domain\r\n"); while(!feof($fp)) { echo fgets($fp,128); } fclose($fp); } } else { echo( "<b>$domain is available for registration.</b><BR>"); } echo ( "</pre><hr><BR>"); } } ?> END OF CODE ------------------------------------------------ -- Shashank Tripathi http://shanx.com

« previous php.windows (#1565) next »