Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am trying to write a script to fetch whois information for a bunch of sites. I am facing two problems:

1) whois command arbitrarily returns fgets/connection reset errors. Trying multiple times for a site often works but is very ugly.

2) The data returned doesnt seem to be in standard format. For example, for my current list, all domains are registered by one of 4 registrars. However, the registrar entry has various formats:

Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Registrar: GODADDY.COM, INC.
Registrar: NETFIRMS, INC.
Sponsoring Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM Created by Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM Last Updated by Registrar: DIRECTI INTERNET SOLUTIONS PVT. LTD. D/B/A PUBLICDOMAINREGISTRY.COM
Sponsoring Registrar: GODADDY.COM, INC. Created by Registrar: GODADDY.COM, INC. Last Updated by Registrar: GODADDY.COM, INC.
Sponsoring Registrar:#1 Indian Domains dba Mitsu.in (R74-AFIN)
Sponsoring Registrar:Business Solutions (R54-AFIN)
Sponsoring Registrar:Directi Internet Solutions Pvt. Ltd. d/b/a PublicDomainRegistry.com (R27-LROR)
Sponsoring Registrar:GoDaddy.com Inc. (R171-LRMS)
Sponsoring Registrar:GoDaddy.com, Inc. (146) Created by Registrar:GoDaddy.com, Inc. (146) Last Updated by Registrar:Afilias Ltd. (4000017)
Sponsoring Registrar:GoDaddy.com, Inc. (R91-LROR)
Sponsoring Registrar:IN Registrar d.b.a. inregistrar.com (R123-AFIN)
Sponsoring Registrar:Netfirms, Inc. (R1427-LROR)
Sponsoring Registrar:eNom, Inc. (R126-LRMS)

Is there any way to reliably get the fields like expiration date and registrar for a domain (I am willing to write custom php scripts).

regards,

JP

share|improve this question

1 Answer 1

up vote 3 down vote accepted

WHOIS service doesn't follow any standard.

I know it very well because I'm the maintainer of the Ruby Whois library. The goal of the library is to provide a OOP way to parse and get Whois details for a domain name.

Give the library a try. Unfortunately, there's no similar tool in PHP.

share|improve this answer
    
Thanks. I will give the library a try. –  JP19 Dec 14 '10 at 6:50
    
phpwhois.org - and what about this PHP library? –  MartyIX Aug 15 '11 at 22:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.