Re: WHOIS query of IP address?
| From: | James H. Cloos Jr. | Date: | Sun, 24 Dec 2000 03:42:08 +0000 |
| Subject: | Re: WHOIS query of IP address? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31734@lists.php.net to get a copy of this message | ||
>>>>> "bill" == bill <bill@billtron.com> writes:
bill> Is it possible to have PHP run a whois query of a known IP
bill> address? Not every query would return info, of course, but the
bill> results could be stored in a string and echoed to the browser, I
bill> suspect.
The whois is just like the finger protocol: open a socket and send a
single line terminated in /r/n with the query data, read the reply until
eond-of-data.
So, use fsockopen() or similar to open port 43 on whois.arin.net, send
the ip address in dotted-quad format terminated by \r\n, read the reply.
You'll have to parse it if you want to dig deeper for non-arin IP numbers.
You can also direct the query to whois.geektools.com (or another site
running their proxy, such as whois.jhcloos.net) which will do the parsing
and subsequent queries for you.
-JimC
--
James H. Cloos, Jr. <http://jhcloos.com/public_key> 1024D/ED7DAEA6
<cloos@jhcloos.com> E9E9 F828 61A4 6EA9 0F2B 63E7 997A 9F17 ED7D AEA6