Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Kanji said:

I second the use of DNS instead of whois.

but himanh said...

Basically checking if any of my domains are transferred or still with me.

So, if himanh asks his DNS server, he will always believe the domain is with him. Just wanted to throw in this advice.

If you want to make it work, you need to ask a root name server for the delegation information to reach to the name servers. For instance...

#!/usr/bin/perl -w use strict; use NetAddr::IP; use Net::DNS::Resolver; my $res = new Net::DNS::Resolver; # For domains in CCTLDs, you need to ask root-servers.net instead # and follow the delegation chain. $res->nameservers(NetAddr::IP->new("g.gtld-servers.net")->addr); for my $dom (map { chomp; $_ } <DATA>) { my $packet = $res->query($dom, 'NS'); # No answer received... unless ($packet) { warn "No response for $dom\n"; next; } # A DNS answer (response) was received but ... my @answer = $packet->answer; # ... it might not contain real answers ... unless (@answer) { warn "Response packet contains no answer section for $dom\n"; next; } # ... or it might be what I am looking for. for my $s (@answer) { next unless $s->type eq 'NS'; print "$dom: ", $s->nsdname, "\n"; } } __END__ google.com yahoo.com aol.com

will answer the right people for the 7 gTLDs. This is only slightly tested and you might need to change the gtld server to use.

This code should give you something to start playing with...

Best regards

-lem, but some call me fokat


In reply to Re^3: Whois script help by fokat
in thread Whois script help by himanh

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-23 22:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found