像一些网站查的那样,有注册公司,地址等等是用类似追捕的数据文件来帮助的实现的(当然,有的用的是域名查询系统。例如:"com.cn"=>"whois.cnnic.net.cn", 
"net.cn"=>"whois.cnnic.net.cn", 
"org.cn"=>"whois.cnnic.net.cn", 
"edu.cn"=>"whois.edu.cn", 
"com"=>"whois.nsiregistry.net", 
"net"=>"whois.nsiregistry.net", 
"org"=>"whois.nsiregistry.net", 
"biz"=>"whois.nic.biz", 
"sh"=>"whois.nic.sh", 
"cc"=>"whois.nic.cc", 
"edu"=>"rs.internic.net", 而且只有注册的ip才能实现这个功能。另,源文件在
http://www.phpx.com/happy/showthread.php?s=283031c97cdbd581d7256209b7baf679&threadid=6415&highlight=whois

解决方案 »

  1.   

    用socket我就是用socket查询所有的信息的!
      

  2.   

    http://www.phpx.com/happy/showthread.php?threadid=6415
    源代码有误,改了点
    <? 
    $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", 
    "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]; 
    } function connect($Server) 

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

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

    return ($ptr); 

    else 

    $retry++; 
    sleep($SLEEP_TIME); 


    return(-1); 

    function Lookup($domainname) 

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

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

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

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

    else 

    fputs($ptr, preg_replace("/^([^\.]*)\./","",$domainname)."\015\012"); 
    while (!feof($ptr)) 

    $result .= fgets($ptr,128) . "<br>"; 

    fclose($ptr); 
    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>
      

  3.   

    再到网上查了资料,其实只需要访问whois.geektools.com即可,即不需要GetServer函数
      

  4.   

    直接用socket
    $fp = fsockopen("$server", "$port");
    fputs($fp, $domain."\r\n");
    fpassthru($fp);
    $server 服务器
    $port 端口
    $domain 你要查询的域名
      

  5.   

    首先谢谢各位:
        Shakespeare(网络骑士)和qiushuiwuhen(秋水无恨)说的程序我已经有了,但是这个程序查出来的信息还是不一样的。以下是用这个程序查的信息:
    Whois Server Version 1.3 Domain names in the .com, .net, and .org domains can now be registered 
    with many different competing registrars. Go to http://www.internic.net 
    for detailed information. Domain Name: CSDN.NET 
    Registrar: NETWORK SOLUTIONS, INC. 
    Whois Server: whois.networksolutions.com 
    Referral URL: http://www.networksolutions.com 
    Name Server: NS.PHOTOCOME.COM 
    Name Server: DNS.100OK.COM 
    Updated Date: 04-nov-2001 
    >>> Last update of whois database: Wed, 31 Jul 2002 16:43:32 EDT <<< The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and 
    Registrars. 
    而在网站上查得的信息是:
    The Data in the VeriSign Registrar WHOIS database is provided by VeriSign for
    information purposes only, and to assist persons in obtaining information about
    or related to a domain name registration record.  VeriSign does not guarantee
    its accuracy.  Additionally, the data may not reflect updates to billing contact
    information.  By submitting a WHOIS query, you agree to use this Data only
    for lawful purposes and that under no circumstances will you use this Data to:
    (1) allow, enable, or otherwise support the transmission of mass unsolicited,
    commercial advertising or solicitations via e-mail, telephone, or facsimile; or
    (2) enable high volume, automated, electronic processes that apply to VeriSign
    (or its computer systems).  The compilation, repackaging, dissemination or
    other use of this Data is expressly prohibited without the prior written
    consent of VeriSign.  VeriSign reserves the right to terminate your access to
    the VeriSign Registrar WHOIS database in its sole discretion, including
    without limitation, for excessive querying of the WHOIS database or for failure
    to otherwise abide by this policy.  VeriSign reserves the right to modify these
    terms at any time.  By submitting this query, you agree to abide by this policy.
    Registrant:
    Beijing midami technic ltd. (CSDN2-DOM)
       No.3 North Building,LI Kang Hotel,
       Beijng, 100101
       CN   Domain Name: CSDN.NET   Administrative Contact, Technical Contact:
          Tao, Jiang  (JT15146) [email protected]
          Beijing Midami Technology Ltd.
          Likang Hotel,Beichen East Road Chaoyang
          District
          Beijing
          100101
          CN
          +86 10 64950982 +86 10 64950982   Record expires on 11-Mar-2003.
       Record created on 11-Mar-1999.
       Database last updated on 1-Aug-2002 01:09:46 EDT.   Domain servers in listed order:   DNS.100OK.COM                202.108.221.65
       NS.PHOTOCOME.COM             211.101.228.178
    信息明显要少得多,请问这是为什么?
    而qiushuiwuhen(秋水无恨)后介绍的那个地址,我试了一下到是可以出来信息的,但是似乎跟其它网站的信息有一点点的不一样,这只是我的个人感觉。
    另外,我TELNET 如下的地址时whois.networksolutions.com 43只得到前面的一些说明性信息,而后面的如管理员等等信息都出来。但连接并没有断,似乎服务器在接收我的下一步指令,可是我不知道查询whois记录的指令。请问有谁有这方面的资料给介绍一下。谢谢!
      

  6.   

    IP地址获得方法有很多种,比如说自动获得ip的每一次都可能不一样。只有在isp那里注册的才比较固定。
    另外,想一些校园网他们分配了一段ip ,而这些ip的分配是没有办法得知的,而且即使是已经注册的ip也会变动,我想这就是你说的信息不一样的原因吧。而且有的人喜欢用虚拟ip的工具(比如为了用别人的代理  又怕被查),就更麻烦
    所以,这个问题其实很难定论,很难做到精确浅妄薄见,望与斟酌
      

  7.   

    whois.networksolutions.com可以得到你上面的资料ps.不同的whois服务器,不同的数据库