limner has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl
use HTTP::Cookies;
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file => "cookies.txt", autosave => 1));
#$ua->agent("Mozilla 5.0");
$url=" site address";
$v1="2014-03-02";
$v2="2014-03-03";
$req = HTTP::Request->new(GET => $url, $checkin => $v1, $checkout => $v2);
$req->header('Accept' => 'text/html');
$res = $ua->request($req);
if ($res->is_success)
{
$filename="dati_html_test.txt";
open MYFILE, ">:utf8", $filename;
print MYFILE $res->decoded_content; # or whatever
close (MYFILE);
}
else
{
print "Error: " . $res->status_line . "\n";
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: retrieving html
by davido (Cardinal) on Feb 18, 2014 at 19:27 UTC | |
|
Re: retrieving html
by zentara (Cardinal) on Feb 18, 2014 at 21:07 UTC | |
|
Re: retrieving html
by Kenosis (Priest) on Feb 18, 2014 at 22:24 UTC | |
|
Re: retrieving html
by Anonymous Monk on Feb 19, 2014 at 10:51 UTC |