#!/usr/bin/perl
use LWP::UserAgent;
$ua = new LWP::UserAgent;
($ua->proxy('http', "http://".$ARGV[1])) if ($ARGV[1]);
$ua->agent("Mozilla/4.07 [en] (WinNT;I)");
my $req = new HTTP::Request GET => "http://uptime.netcraft.com/up/graph/?host=$ARGV[0]";
my $res = $ua->request($req);
if ($res->is_success) {
$all_content = $res->content;
#$all_content =~ /.* is running <b>(.[^<>]*<\/b> on <b>.[^<>]*<\/b>)/smg;
$all_content =~ /is running(.+)<\/b>\./smg;
$first = $1;
$first =~ s/<b>//g;
$first =~ s/<\/b>//g;
print $first,"\n";
} else {
print $res->as_string(),"\n";
}