WHOIS directory lookup in PHP
Posted in php | Posted on 13-09-2008
Net_Whois lets you query a internet name directory service in a easy to use manner. WHOIS is a protocol which is widely used to determine the owner of a domain name, an IP address by querying an official name database. One possible application I can think of is to see if DNS servers are set correctly for various domains I handle regularly.
The current library uses the following servers to execute the query:
whois.crsnic.net
whois.networksolutions.com
whois.nic.mil
whois.nic.gov
whois.arin.net
whois.ripe.net
whois.apnic.net
whois.ripn.net
whois.ra.net
.whois-servers.net
whois.6bone.net
whois.registro.br
A example code is shown below.
1 2 3 4 5 6 7 8 9 10 | <?php require_once "Net/Whois.php"; $whois = new Net_Whois(); /* You can add other NIC server as a second parameter. */ $info = $whois->query('example.com'); echo($info); ?> |
Note that the class returns a string, so you would need to use regular expressions to get to the relevant information.
