Rumah > Artikel > pembangunan bahagian belakang > php写的域名查询系统whois_PHP教程
if ($domain)
{
if ($domain)
{
$fp = fsockopen( "rs.internic.net", 43, &$errno, &$errstr, 10);
if (!$fp)
{
echo "$errstr ($errno)
n";
}
else
{
fputs($fp, "$domainrn");
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 "$domain is registered at $server:
";
echo ""; <br>$fp = fsockopen($server, 43, &$errno, &$errstr, 10); <br>if(!$fp) <br>{ <br>echo "Could not open connection to $server on port 43.n"; <br>echo "$errstr ($errno)<br>n"; <br>} <br>else <br>{ <br>fputs($fp, "$domainrn"); <br>while(!feof($fp)) <br>{ <br>echo fgets($fp,128); <br>} <br>fclose($fp); <br>} <br>} <br>else { <br>echo( "<b>$domain does not appear to be registered.</b><br>"); <br>} <br>echo ( "
");
}
}
?>