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

up vote 5 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.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.