in reply to Extracting domain names from FQDNs

Would it be possible to start with the last two sections of the domain, and then add one section at a time until Whois gives a result? For example, try 'co.uk', which wouldn't work, then 'lexicon.co.uk', which would. Something like this:
my $host = 'www.lexicon.co.uk'; my @parts = split /\./, $host; my $domain = pop @parts; my $whois = ''; while (@parts and not $whois) { $domain = pop(@parts) . ".$domain"; $whois = Whois($domain); } print $whois;
With adjustments for the specific Whois module being used, of course.

Replies are listed 'Best First'.
(Ovid) Re(2): Extracting domain names from FQDNs
by Ovid (Cardinal) on Dec 02, 2000 at 01:07 UTC
    I've looked into that, but response time is a factor here. Whois is slow enough for the international domains that incrementally testing something like www.cs.flinders.edu.au becomes an issue. Thanks for the comment, though!

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

      Ovid,

      If speed is an issue, why not fork off some children, and search for all variations at once? Assume you the minimal is a domain.TLD, so www.cs.flinder.edu.au would give you:

      www.cs.flinder.edu.au cs.flinder.edu.au flinder.edu.au edu.au
      You can further optimize this by taking a listing of non-foreign TLDs (.com, .net, .edu, .mil, .org, etc) and only running this if your domain does not end in one of these.

      Not a real solution, but perhaps a workaround.

      =Blue
      ...you might be eaten by a grue...