The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::WhoisNG - Perl extension for whois and parsing

SYNOPSIS

  use Net::WhoisNG;
  my $w=new Net::WhoisNG($domain);
  if(!$w->lookUp()){
     print "Domain not Found\n";
     exit;
  }
  # If lookup is successful, record is parsed and ready for use

Methods

   Single Value properties return respective scalars from their getXX methods.
   The available single value getXX method are getExpirationDate(), getLastUpdated(),
   getCreatedDate(), getStatus().

   my $exp_date=$w->getExpirationDate();

   Obtaining name servers is done with getNameServers() which returns a reference to an
   array of name servers.

   my $t_ns=$w->getNameServers();
   my @ns=@$t_ns;

   Contacts are implemeted as a person object.

   my $contact=$w->getPerson($type);

   'type' is one of (admin,tech,registrant,bill)

   The Person Object implements several methods to obtain properties of the contact

   $contact->getCredentials(); #Returns a ref to an array of contact info for $type

   getCredentials() was implemeted to return an unparsed set of info about a contact beacause some
   whois servers are so irregular in their formatting that it was a impractical to
   parse the contact info further. Where available such as with .org and .info the following methods work.

   getName(), getOrganization(), getState(), getPostalCode, getCountry(), getEmail(),
   getStreet(), getPhone(), getFax()

   you can get an XML representation of the Data if you the the optional XML::simple module by calling
    $w->getXML();

DESCRIPTION

Whois Next Generation. Whois lookup module alternative to Net::Whois

This module is used to lookup whois information on domains.

This version supports the com, net, org, info, biz, us and edu TLDs. Rapidly implementing other TLDs.

next in line .co.uk .org.uk .net.uk. I think these all have the same format so will only need one implementation. let me know which ones you'd want implemented sooner than others.

The module starts by examinig the extension and setting the appropriate whois server. The whois server URL is constructed as $tld.whois-servers.net. The method lookUp() then tries to connect and query the server. It then hands over to a parser and returns 1 if successful or 0 otherwise. U can then obtain various properties using methods listed above. Note that not all properties will be defined for every domain.

EXAMPLE

   use Net::WhoisNG();
   my $w = new Net::WhoisNG();

   if($w->lookUp()){
      my $rawxml = $w->toXML(); # Get raw XML representation (XML::Simple required)
      my $exp_date=$w->getExpirationDate();
   }

XML Printout

   <?xml version='1.0' standalone='yes'?>
   <opt>
     <domain_name>perl.org</domain_name>
     <expiration_date>May-30-2010</expiration_date>
     <last_updated_date>Nov-12-2006</last_updated_date>
     <name_server>ns2.develooper.com</name_server>
     <name_server>ns1.us.bitnames.com</name_server>
     <name_server>ns2.us.bitnames.com</name_server>
     <name_server>ns1.eu.bitnames.com</name_server>
     <status>1</status>
     <contact>
       <name>perl.org hostmaster</name>
       <city>Beverly Hills</city>
       <country>US</country>
       <email>dns@perl.org</email>
       <organization>The Perl Foundation</organization>
       <parsed>1</parsed>
       <phone>+1.8665501313</phone>
       <postalcode>90209</postalcode>
       <street>PO Box 18111</street>
       <type>tech</type>
     </contact>
     <contact>
       <detail>Golden West Telecomm</detail>
       <detail>System Administrator</detail>
       <detail>PO Box 411</detail>
       <detail>Wall, SD 57790</detail>
       <detail>US</detail>
       <detail>+1.6052792161 (FAX) +1.6052792727</detail>
       <detail>33772@whois.gkg.net</detail>
       <parsed>0</parsed>
       <type>tech</type>
     </contact>
   </opt>

   Above XML shows the elements and how they are organized for XML output. There are two
   formats for representing whois contacts. One just dumps an unparsed record of the contact's
   deatails as shown in secend contact while the other one splits this into specific contact
   properties. Every contact will have a <parsed>1|0</parsed> element to indicate whether the
   contact information is parsed any further. The reason for the unparsed version as mentioned
   earlier, is the inconsistencies of some whois servers. The tag <status>0|1</status> shows
   whether domain is active or not.

DEPENDECIES

 Net::WhoisNG::Person - Bundled along
 XML::Simple - (optional) for XML output

SEE ALSO

Net::WhoisNG::Person, whois

http://www.stiqs.org

AUTHOR

Pritchard Musonda, <stiqs@blackhills.net<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Pritchard Musonda

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.