用下面的代码
$fp = fsockopen($server, 43);
fputs($fp, "aaa.com.cn"."\r\n");
fpassthru($fp);

解决方案 »

  1.   

    完整的例子
    http://www.pccome.com/pc/knowsky/list.asp?id=2057
      

  2.   

    呵呵。只要你会socket就可以。不会也没问题。会就可以php。
    hois,其实就是查询服务器段口
      

  3.   

    to: boy2002333() (
    那个例子不全,有没有权的代码呀?
    我急用。
    ps:我如何知道那些是whois服务器呀?
      

  4.   

    <? 
    $PORT=43; 
    $MAX_RETRIES=5; 
    $SLEEP_TIME=2; 
    function Getserver($domain) 

    $Servers=array( 
    "net.cn"=>"whois.cnnic.net.cn", 
    "com.cn"=>"whois.cnnic.net.cn", 
    "cn"=>"whois.geektools.com",
    "net"=>"whois.nsiregistry.net", 
    "cc.cn"=>"whois.nic.cc", 
    "com"=>"whois.nsiregistry.net", 
    "edu.cn"=>"whois.edu.cn", 
    "edu"=>"rs.internic.net", 
    "gov"=>"whois.nic.gov" 
    ); 

    $domain=preg_replace("/^([^\.]*)\.([^\.]*)\./","",$domain);
    return $Servers[$domain]; 
    /*
    return "whois.nic.cc";
    return "whois.OnlineNIC.com";
    return "whois.nsiregistry.net";
    return "whois.cnnic.net.cn";
    return "rs.internic.net";
    return "whois.edu.cn"; //教育网
    return "whois.OnlineNic.com";
    */
    return "whois.nsiregistry.net";
    return "whois.networksolutions.com";//csdn
    return "whois.arin.net";
    return "whois.InterNIC.net";
    return "whois.verisign-grs.com";
    return "whois.geektools.com";
    } function connect($Server) 

    global $RETRY,$PORT,$SLEEP_TIME; 
    if ($Server=="") {return(-1);} 
    $retry=0; 
    while ($retry<=$MAX_RETRIES) 

    $ptr=fsockopen($Server,$PORT); 
    if ($ptr>0) 

    return ($ptr); 

    else 

    $retry++; 
    sleep($SLEEP_TIME); 


    return(-1); 

    function Lookup($domainname,$server="") 

    global $result; 
    if(empty($server))$server=Getserver($domainname); 
    if (empty($server)) 

    $result="没有与该域名匹配的Whois服务器,是否拼错了?"; 
    return $result; 

    $ptr=connect($server); 
    if ($ptr==-1) 

    $result="无法连接到Whois服务器$server"; 
    return $result; 

    else 

    $result="";
    fputs($ptr, preg_replace("/^([^\.]*)\./","",$domainname)."\015\012"); 
    while (!feof($ptr)) $result .= fgets($ptr,128) . "<br>"; 
    fclose($ptr); 
    if(preg_match("|Whois Server:\s(.+)\n|",$result,$matches)&&$matches[1]!=$server)
    $result=Lookup($domainname,$matches[1]);//added by qiushuiwuhen(2002-8-18)
    return $result; 
    } } ?> <html> 
    <head> 
    <title>Untitled Document</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    </head> 
    <form action=<?=$PHP_SELF?>>请输入欲查询的域名(带后缀):<input name=domainname></form>
    <body> 
    <? 
    echo "查询结果如下:"; 
    echo "<hr>"; 
    if(empty($domainname))$domainname="www.csdn.net"; 
    print Getserver($domainname); 
    print "<hr>"; 
    $result=Lookup($domainname); 
    echo $result; 
    ?> 
    </body> 
    </html>
      

  5.   

    可以将以下这些行
    /*
    return "whois.nic.cc";
    return "whois.OnlineNIC.com";
    return "whois.nsiregistry.net";
    return "whois.cnnic.net.cn";
    return "rs.internic.net";
    return "whois.edu.cn"; //教育网
    return "whois.OnlineNic.com";
    */
    return "whois.nsiregistry.net";
    return "whois.networksolutions.com";//csdn
    return "whois.arin.net";
    return "whois.InterNIC.net";
    return "whois.verisign-grs.com";
    return "whois.geektools.com";
    去掉,因为这些都是测试用whois服务器