<?xml version="1.0" encoding="windows-1252"?>
<node id="421483" title="Re^3: Whois script help" created="2005-01-11 21:46:27" updated="2005-03-24 22:08:13">
<type id="11">
note</type>
<author id="107541">
fokat</author>
<data>
<field name="doctext">
&lt;p&gt;[Kanji] said:&lt;/p&gt;
&lt;blockquote&gt;I second the use of DNS instead of whois.&lt;/blockquote&gt;
&lt;p&gt;but [himanh] said...&lt;/p&gt;

&lt;blockquote&gt;Basically checking if any of my domains are transferred or still with me.&lt;/blockquote&gt;

&lt;p&gt;So, if [himanh] asks &lt;strong&gt;his&lt;/strong&gt; DNS server, he will always believe the domain is with him. Just wanted to throw in this advice.&lt;/p&gt;

&lt;p&gt;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...&lt;/p&gt;

&lt;code&gt;#!/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-&gt;nameservers(NetAddr::IP-&gt;new("g.gtld-servers.net")-&gt;addr);

for my $dom (map { chomp; $_ } &lt;DATA&gt;)
{
    my $packet = $res-&gt;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-&gt;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-&gt;type eq 'NS';
	print "$dom: ", $s-&gt;nsdname, "\n";
    }
}

__END__
google.com
yahoo.com
aol.com&lt;/code&gt;

&lt;p&gt;will answer the right people for the 7 gTLDs. &lt;em&gt;This is only slightly tested&lt;/em&gt; and you might need to change the gtld server to use.&lt;/p&gt;

&lt;p&gt;This code should give you something to start playing with...&lt;/p&gt;
 
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-107541"&gt;
&lt;P&gt;Best regards&lt;/P&gt;

&lt;P&gt;-&lt;A HREF="http://mipagina.cantv.net/lem/"&gt;lem&lt;/A&gt;, but some call me fokat
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
421334</field>
<field name="parent_node">
421379</field>
</data>
</node>
