Delphi idWhois错误的数据

时间:2015-02-19 14:24:41

标签: delphi indy whois

使用idWhois组件处理.com域时,我得到错误的信息。以下是通过idWhois收到的stackoverflow.com数据示例

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to internic.net
for detailed information.

   Domain Name: STACKOVERFLOW.COM
   Registrar: NAME.COM, INC.
   Sponsoring Registrar IANA ID: 625
   Whois Server: whois.name.com
   Referral URL: name.com
   Name Server: CF-DNS01.STACKOVERFLOW.COM
   Name Server: CF-DNS02.STACKOVERFLOW.COM
   Status: clientTransferProhibited 
   Updated Date: 09-may-2014
   Creation Date: 26-dec-2003
   Expiration Date: 26-dec-2015

>>> Last update of whois database: Thu, 19 Feb 2015 14:02:05 GMT <<<

NOTICE: The expiration date displayed in this record is the date the 
registrar's sponsorship of the domain name registration in the registry is 
currently set to expire. This date does not necessarily reflect the expiration 
date of the domain name registrant's agreement with the sponsoring 
registrar.  Users may consult the sponsoring registrar's Whois database to 
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois 
database through the use of electronic processes that are high-volume and 
automated except as reasonably necessary to register domain names or 
modify existing registrations; the Data in VeriSign Global Registry 
Services' ("VeriSign") 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. By submitting a Whois query, you agree to abide 
by the following terms of use: You agree that you may 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. You agree not to 
use electronic processes that are automated and high-volume to access or 
query the Whois database except as reasonably necessary to register 
domain names or modify existing registrations. VeriSign reserves the right 
to restrict your access to the Whois database in its sole discretion to ensure 
operational stability.  VeriSign may restrict or terminate your access to the 
Whois database for failure to abide by these terms of use. VeriSign 
reserves the right to modify these terms at any time. 

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

以下是saim域的结果,但使用的是PHP脚本:

*Domain Name: STACKOVERFLOW.COM
Registry Domain ID: 108907621_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.name.com
Registrar URL: name.com
Updated Date: 2014-05-09T17:51:17-06:00Z
Creation Date: 2003-12-26T19:18:07-07:00Z
Registrar Registration Expiration Date: 2015-12-26T19:18:07-07:00Z
Registrar: Name.com, Inc.
Registrar IANA ID: 625
Registrar Abuse Contact Email: abuse@name.com
Registrar Abuse Contact Phone: +1.17203101849
Reseller:
Domain Status: clientTransferProhibited
Registry Registrant ID:
Registrant Name: Sysadmin Team
Registrant Organization: Stack Exchange, Inc.
Registrant Street: 1 Exchange Plaza , Floor 26
Registrant City: New York
Registrant State/Province: NY
Registrant Postal Code: 10006
Registrant Country: US
Registrant Phone: +1.2122328280
Registrant Email: sysadmin-team@stackoverflow.com
Registry Admin ID:
Admin Name: Sysadmin Team
Admin Organization: Stack Exchange, Inc.
Admin Street: 1 Exchange Plaza , Floor 26
Admin City: New York
Admin State/Province: NY
Admin Postal Code: 10006
Admin Country: US
Admin Phone: +1.2122328280
Admin Email: sysadmin-team@stackoverflow.com
Registry Tech ID:
Tech Name: Sysadmin Team
Tech Organization: Stack Exchange, Inc.
Tech Street: 1 Exchange Plaza , Floor 26
Tech City: New York
Tech State/Province: NY
Tech Postal Code: 10006
Tech Country: US
Tech Phone: +1.2122328280
Tech Email: sysadmin-team@stackoverflow.com
Name Server: cf-dns02.stackoverflow.com
Name Server: cf-dns01.stackoverflow.com

对于这两个请求,我使用服务器whois.verisign-grs.com。我试着放置&#34; =&#34;在域名之前,但这没有帮助。这里是Delphi代码

W := TIdWhois.Create(nil);
W.ReadTimeout := 10000;
W.ConnectTimeout := 10000;
try
  W.Host := 'whois.verisign-grs.com';
  if Zone = 'com' then
    Result := W.WhoIs('=' + Domain)
  else
    Result := W.WhoIs(Domain);
except end;
W.Free;

这里的PHP代码

function QueryWhoisServer($whoisserver, $domain) {
  $port = 43;
  $timeout = 15;
  $fp = @fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die("Socket Error " . $errno . " - " . $errstr);
  if($whoisserver == "whois.verisign-grs.com") $domain = "=".$domain; 
  fputs($fp, $domain . "\r\n");
  $out = "";
  while(!feof($fp)){
      $out .= fgets($fp);
  }
  fclose($fp);

  $res = "";
  if((strpos(strtolower($out), "error") === FALSE) && (strpos(strtolower($out), "not allocated") === FALSE)) {
      $rows = explode("\n", $out);
      foreach($rows as $row) {
          $row = trim($row);
          if(($row != '') && ($row{0} != '#') && ($row{0} != '%')) {
              $res .= $row."\n";
          }
      }
  }
  return $res;
}

谢谢

2 个答案:

答案 0 :(得分:2)

.COM域名支持许多注册商现在拥有自己的WHOIS规定,如输出中所述:

  

现在可以注册.com和.net域中的域名   许多不同的竞争注册商。有关详细信息,请访问internic.net   信息。

您将获得WHOIS服务器以在初始响应中进行查询:

Whois Server: whois.name.com

因此,您需要执行两次WHOIS查询,一次针对Verisign,其中包含.COM域名的初始记录,另一次针对注册商WHOIS。

答案 1 :(得分:0)

问题不在于TIdWhois,它正在做与PHP脚本完全相同的事情:

function TIdWHOIS.WhoIs(const ADomain: string): string;
begin
  Connect; try
    IOHandler.WriteLn(ADomain);
    Result := IOHandler.AllData;
  finally Disconnect; end;
end;

TIdWhois只是返回服务器发送的任何内容。