Hi everyone!
I've developed a little perl program using the module LWP to download italian stock pages,
to make real time statistics.
The program works for delayed data, but it doesn't work for real time data because of the
authentication.
I mean the authentication is made at session level, so I need to authenticate in some
way in the same program.
I've tried to use $ua->credentials and $req->authorization_basic, but without results.
I confess I'm novice in perl programming and in using LWP, and surely it's my fault.
Can anyone help me?
My simple code is:
$protected_page="
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
#
# Authentication block ???
#
$req = HTTP::Request->new(GET => "<$protected_page>");
$res = $ua->request($req);
if ($res->is_success)
{
$out="c:/mypage.txt";
open OUT, ">$out" or die "Cannot open $out for write :$!";
print OUT $res->content;
close OUT;
}
else
{
print "Time out: fault in download \n";
}
If you would like to test if it works I can leave the logging credentials.
Site logging page: username: yer
password: man
I thank you in advance for whatever help you can give me.
I've developed a little perl program using the module LWP to download italian stock pages,
to make real time statistics.
The program works for delayed data, but it doesn't work for real time data because of the
authentication.
I mean the authentication is made at session level, so I need to authenticate in some
way in the same program.
I've tried to use $ua->credentials and $req->authorization_basic, but without results.
I confess I'm novice in perl programming and in using LWP, and surely it's my fault.
Can anyone help me?
My simple code is:
$protected_page="
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
#
# Authentication block ???
#
$req = HTTP::Request->new(GET => "<$protected_page>");
$res = $ua->request($req);
if ($res->is_success)
{
$out="c:/mypage.txt";
open OUT, ">$out" or die "Cannot open $out for write :$!";
print OUT $res->content;
close OUT;
}
else
{
print "Time out: fault in download \n";
}
If you would like to test if it works I can leave the logging credentials.
Site logging page: username: yer
password: man
I thank you in advance for whatever help you can give me.