November 2002
Intermediate to advanced
640 pages
16h 33m
English
You want to look up contact information or other details about a domain name.
Use
PEAR’s
Net_Whois class:
require 'Net/Whois.php'; $server = 'whois.networksolutions.com'; $query = 'example.org'; $data = Net_Whois::query($server, $query);
The Net_Whois::query( )
method
returns a large text string whose contents reinforce how hard it can
be to parse different Whois results:
Registrant:
Internet Assigned Numbers Authority (EXAMPLE2-DOM)
4676 Admiralty Way, Suite 330
Marina del Rey, CA 90292
US
Domain Name: EXAMPLE.ORG
Administrative Contact, Technical Contact, Billing Contact:
Internet Assigned Numbers Authority (IANA) iana@IANA.ORG
4676 Admiralty Way, Suite 330
Marina del Rey, CA 90292
US
310-823-9358
Fax- 310-823-8649
Record last updated on 07-Jan-2002.
Record expires on 01-Sep-2009.
Record created on 31-Aug-1995.
Database last updated on 6-Apr-2002 02:56:00 EST.
Domain servers in listed order:
A.IANA-SERVERS.NET 192.0.34.43
B.IANA-SERVERS.NET 193.0.0.236For instance, if you want to parse out the names and IP addresses of the domain name servers, use this:
preg_match_all('/^\s*([\S]+)\s+([\d.]+)\s*$/m', $data, $dns,
PREG_SET_ORDER);
foreach ($dns as $server) {
print "$server[1] : $server[2]\n";
}You must set $server to the correct Whois server
for a domain to get information about that domain. If you
don’t know the server to use, query
whois.internic.net:
require 'Net/Whois.php'; print Net_Whois::query('whois.internic.net','example.org'); ...Read now
Unlock full access