简体   繁体   English

WHOIS查询对象

[英]WHOIS query object

Ok....while learning web development every so often i get stuck, knowing that i'm missing a one little basic piece of information and just grinding to find out what. 好的。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。一次。 It happens because experienced programmers don't care about restating the basics. 之所以发生这种情况,是因为经验丰富的程序员不在乎重述基础知识。

Anyway, i am trying to retrieve information from a WHOIS server, namely whois.apnic.net. 无论如何,我正在尝试从WHOIS服务器(即whois.apnic.net)检索信息。 Now this query works fine and returns all 1528 bytes 现在此查询可以正常工作并返回所有1528个字节

<?php
$abc=fsockopen("whois.godaddy.com", 43);
$xyz="website.com";
fputs($abc,$xyz);
$output = fread($abc,1528);
print_r($output);
if(!$output)
{
echo "there is no output";
}
?>

But this one only returns the first two lines 但是这个只返回前两行

<?php
$abc=fsockopen("whois.apnic.net", 43);
$xyz="194.6.248.10";
fputs($abc,$xyz);
$output = fread($abc,1528);
print_r($output);
if(!$output)
{
echo "there is no output";
}
?>

I have tried a lot of modifications in the code for example fgets instead of fread, url instead of ip address, when i put while(!feof($abc)) condition into the prior code it returns everything, but when i put this in the second code it just times out or keeps working if i remove the time limit. 我在代码中尝试了很多修改,例如fgets而不是freads,url而不是IP地址,当我将while(!feof($ abc))条件放入先前的代码中时,它将返回所有内容,但是当我将其放入时第二个代码只是超时或如果我删除时间限制,则可以继续工作。 The above IP address is from Europe but the online Apnic WHOIS tool gives information about it and the WHOIS API documentation also states that Apnic can contact other Registries and retrieve info about any IP address. 上面的IP地址来自欧洲,但是在线Apnic WHOIS工具提供了有关此信息,并且WHOIS API文档还指出,Apnic可以联系其他注册机构并检索有关任何IP地址的信息。

The apnic website talks about sending and returning objects, just 'objects', no reference. apnic网站谈论的是发送和返回对象,只是“对象”,没有参考。 I presumed its talking about XML objects. 我以为它是在谈论XML对象。 I just want a small, basic, simple example of how to query this API and get and output the 'objects'. 我只想要一个小的,基本的简单示例,说明如何查询此API以及获取和输出“对象”。 Thanks! 谢谢!

您要查找的IP地址在RIPE(Whois.ripe.net)而不是APNIC管理的范围内。

    $whoisserver = 'whois.verisign-grs.com';
$domain = 'name.com';
$port = 43;
$timeout = 10;
$fp = @fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die("Socket Error " . $errno . " - " . $errstr);
fputs($fp, $domain . "\r\n");
while(!feof($fp)){
    $out .= fgets($fp);
}
fclose($fp);
  1. .com whois whois.verisign-grs.com .com whois whois.verisign-grs.com
  2. .net whois whois.verisign-grs.com .net whois whois.verisign-grs.com
  3. .org whois whois.pir.org .org whois whois.pir.org
  4. etc. 等等

The service url: http://akan.online/checkName.com happy saturday 服务网址: http ://akan.online/checkName.com星期六快乐

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM