Hi,

I have a "links directory", and I'm trying to update the records with as much "proper" data as possible. I've tried using Net::Whois, but that doesn't seem to work. Now, what I need - is a variable or something returned like:

$ref->{administrator}->{phone} .. or something like that.

I've got it working with some domain types (but cos it changes so much between WHOIS records, this doesn't work on a ton of domains - so at the moment, is pretty useless :()

The code I have at the moment is:

my $dominfo = `whois $_`; #whois('perl.com'); my ($name,$email,$phone); # print qq|WHOIS: <pre>$dominfo</pre>|; my @split = split /\n/, $dominfo; foreach (@split) { s/^(\t+|\s+)//sig; s/\s+/ /sig; if (($_ =~ /^Name:(.*)/ || $_ =~ /^Registrant Name:(.*)/) +&& !$name) { # print "NAME IS: $1 \n"; $name = $1; $name =~ s/^\s+//; next; } if (($_ =~ /^Email Address:(.*)/ || $_ =~ /^Registrant Ema +il:(.*)/) && !$email) { # print "NAME IS: $1 \n"; $email = lc($1); $email =~ s/^\s+//; next; } if (($_ =~ /^Phone Number:(.*)/ || $_ =~ /^Registrant Phon +e:(.*)/) && !$phone) { # print "PHONE IS: $1 \n"; $phone = $1; $phone =~ s/^\s+//; next; } }


If anyone has any suggestions, I'm all ears :)

TIA!

Andy

In reply to Getting whois data. by ultranerds

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.