Response Format

Todd Caine todd_caine at eli.net
Wed Aug 14 14:00:34 EDT 2002


Hi John,

"Brzozowski, John Jason" wrote:

> Also, is there any XML support if no is it planned?

I'm working on a Perl extension for the new whois server output called
Net::Whois::ARIN.  If no XML support is planned it would be fairly simple to
combine the use of a module like this with XML::Simple to get Whois output in
XML format.

Here's some example code:

use Net::Whois::ARIN;
use XML::Simple;

my $o = Net::Whois::ARIN->new(
    -host => 'beta.arin.net',
    -port => 4344,
);

my %rec = $o->query_handle('ELIX');

XMLout(
    \%rec,
    xmldecl  => 1,
    noattr   => 1,
    rootname => 'Record'
);

exit;

The output from this would be:

<?xml version='1.0' standalone='yes'?>
<Record>
  <Country>US</Country>
  <Comment></Comment>
  <Address>4400 NE 77th Ave Vancouver, WA 98662</Address>
  <Updated>2001-09-26</Updated>
  <RegDate>1999-01-19</RegDate>
  <OrgID>ELIX</OrgID>
  <OrgName>Electric Lightwave Inc</OrgName>
</Record>

The hash returned could be used directly to access the values needed also like:

printf(
    "OrgID %s was registered to %s on %s.\n",
    $rec{'OrgID'},
    $rec{'OrgName'},
    $rec{'RegDate'}
);

Which would print:

OrgID ELIX was registered to Electric Lightwave Inc on 1999-01-19.

I could put an alpha version of Net::Whois::ARIN on the CPAN if anyone is
interested in playing with this interface.

Regards,
Todd





More information about the Dbwg mailing list