#!/usr/bin/perl -w # Script to check .dk domains against DK whois DB # Author: Michael L. Hostbaek # # Use: ./dk-whois.pl [domain.dk] {domain2.dk} {domain3.dk} use LWP; my $browser; my $url = "http://www.dk-hostmaster.dk/perl/Whois.pl?lang=da&query="; my $webdoc; my $dom; my $sendurl; my $content; if(!(@ARGV)) { print "No domain specified!\nPlease run with a domain name fx. domain.dk\n"; exit; } else { $browser = LWP::UserAgent->new(); foreach $dom (@ARGV) { $sendurl = "$url$dom"; $webdoc = $browser->request(HTTP::Request->new(GET => $sendurl)); if($webdoc->is_success) { $content = $webdoc->content; $content =~ s/<([^\0]*?)>//g; $content =~ s/^\s+//g; $content =~ s/\s+$//g; $content =~ s/^$//g; print STDOUT "$content\n"; } else { print STDERR "$0: Could not fetch $url\n"; } } }