#!/usr/bin/perl $!=1; use HTTP::Request; use HTTP::Response; use LWP; use LWP::Simple; use LWP::UserAgent; print "Content-Type: text/html\n\n"; #Get the list of all urls and strings from the file open(URLS, "urls.txt"); @url_list = ; close(URLS); print "\n"; print ""; foreach $line (@url_list) { chomp($line); #Seprate url and the string @values = split(',',$line); http200check($values[0],$values[1]); } print "
URLStatusString Found on Page
\n"; exit; sub http200check { my $u=@_[0]; my $read_line=@_[1]; my $ua = LWP::UserAgent->new(timeout => 240); $agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Alexa Toolbar) K"; $ref = "http://www.adroitweb.com/cgi-bin/monitor.cgi"; #print "[$u]\n"; $ua->agent($agent); $req = HTTP::Request->new(GET => $u); $req->referer($ref); #Get the url $resp = $ua->request($req); $code = $resp->code; #If it is success if ($resp->is_success) { $fullresp = $resp->content(); #If line is found on the page if($fullresp =~ m/$read_line/) { print "$uSuccess$read_line\n"; } else { # line not found on the page print "$uFailedSite Up. Strong Not Found: '$read_line'\n"; } } else { # page could not be fetched. print "$u"; print "FailedSite not reachable. HTTP Code: $code\n"; } } # end of function http200check