tags:

views:

461

answers:

2

Is there a library or common heuristic for parsing whois results programatically? I'm working on a signup form for an ISP, and they'd like to be able to check for domain name availability during the signup process.

It seems like there's a lot of variation in whois results from the different top level domains

Not found: sdfasdfasdfsdfds.us
No match for "SDFASDFASDFSDFDS.COM".

Looking specifically for PHP, but a library in any language would do.

+1  A: 

Maybe the PEAR package Net_Whois could be helpful :

The PEAR::Net_Whois class provides a tool to query internet domain name and network number directory services

Unfortunatly, the given example is quite poor, and doesn't show much about what the library can do ;-(


After giving it a try, it's not that great actually :-(

Maybe The Net_DNS package could be helpful, though... but still probably not quite perfect ;-(

Pascal MARTIN
+1  A: 

The PHPWhois library is a base class to execute WHOIS queries and parse the response.

If you can use Ruby, have a look at my Whois Gem. It is a os-independent library which provides almost the same WHOIS facilities included in the Linux Debian whois package with additional features, including the ability to parse the WHOIS response.

Here's a quick overview.

a = Whois.whois("google.it")
# => #<Whois::Answer>

a.available?
# => false
a.registered?
# => true

a.created_on
# => Fri Dec 10 00:00:00 +0100 1999

t = a.techinical
# => #<Whois::Answer::Contact>
t.id
# => "TS7016-ITNIC" 
t.name
# => "Technical Services" 

a.nameservers.each do |nameserver|
  puts nameserver
end
Simone Carletti