【问题标题】:Delphi idWhois wrong dataDelphi idWhois 错误数据
【发布时间】:2015-02-19 14:24:40
【问题描述】:

使用 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。我试图在域之前放置“=”,但这没有帮助。这是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;
}

谢谢

【问题讨论】:

    标签: delphi indy whois


    【解决方案1】:

    .COM 域现在支持许多具有自己的 WHOIS 条款的注册商,如输出中所述:

    .com 和 .net 域中的域名现在可以注册到 许多不同的竞争注册商。去internic.net了解详细信息 信息。

    在初始响应中为您提供要查询的 WHOIS 服务器:

    Whois Server: whois.name.com
    

    因此,您需要执行两次 WHOIS 查询,第一次是针对包含 .COM 域初始记录的威瑞信,然后是针对注册商 WHOIS。

    【讨论】:

    • @Ivan 然后请接受此答案以结束问题。
    【解决方案2】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多