#!/usr/bin/perl -w # Script to check .dk domains against DK whois DB # Author: Michael L. Hostbaek # $Id: dk-whois2.txt,v 1.1 2002/01/18 14:08:08 mich Exp $ # # Use: ./dk-whois.pl [domain.dk] {domain2.dk} {domain3.dk} use LWP; my $browser; my $url = "http://www.dk-hostmaster.dk/script/whois.php?&lang=eng&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/\ \;/ /g; $content =~ s//<title/g; $content =~ s/<\/title>/title>/g; $content =~ s/<([^\0]*?)>//g; $content =~ s/^\s+//g; $content =~ s/\s+$//g; $content =~ s/^$//g; $content =~ s/\n[^\n]*\z//; print STDOUT "$content\n"; } else { print STDERR "$0: Could not fetch $url\n"; } } }