首页 > 网络编程 > php > 正文

PHP写的域名查询系统whois
2007-09-27 01:53:53???来源:???评论:0 点击:

if ($domain) 
{ 
if ($domain) 
    { 
     
    $fp = fsockopen( "rs.internic.net", 43, &$errno, &$errstr, 10); 
    if (!$fp) 
  { 
    echo "$errstr ($errno)
n"; 
    } 
    else 
    
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 "
";  
        $fp = fsockopen($server, 43, &$errno, &$errstr, 10); 
        if(!$fp) 
            { 
            echo "Could not open connection to $server on port 43.n"; 
            echo "$errstr ($errno)
n"; 
            } 
        else 
            { 
            fputs($fp, "$domainrn"); 
            while(!feof($fp)) 
                { 
                echo fgets($fp,128); 
                } 
            fclose($fp); 
            } 
        } 
    else  { 
        echo( "$domain does not appear to be registered.
"); 
        } 
    echo ( "

"); 
    } 
 
} 
?> 
 
 查找 .com, .org, and .net 主机
 
 主机名:  
  

相关热词搜索:PHP写的域名查询系统whois

上一篇:如何开发一个虚拟域名系统
下一篇:PHP完全手册

分享到: 收藏