jonsmith1982
Technical User
im new to programming and im trying to make a webpage checker.
I found this script, seems to work ok, but id like to replace the website url with a variable so it can be changed. Without having to edit any script.
Also id like to add a second part to the website url,
(i.e. $website = $webpage = /members.html)
use strict; use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
$ua->agent("TestBot/0.1"); # pretend we are very capable browser
my $req = HTTP::Request->new ('GET' => ' $req->header('Accept' => 'text/html');
# send request
my $res = $ua->request($req);
# check the outcome
if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; }
I found this script, seems to work ok, but id like to replace the website url with a variable so it can be changed. Without having to edit any script.
Also id like to add a second part to the website url,
(i.e. $website = $webpage = /members.html)
use strict; use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
$ua->agent("TestBot/0.1"); # pretend we are very capable browser
my $req = HTTP::Request->new ('GET' => ' $req->header('Accept' => 'text/html');
# send request
my $res = $ua->request($req);
# check the outcome
if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; }