Gossamer Forum
Home : General : Perl Programming :

download authorized pages via LWP

Quote Reply
download authorized pages via LWP
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="http://www.24oreborsaonline.ilsole24ore.com/fc?sezId=10026&cmd=miafinanza&page=ListinoPersonale";
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: http://www.24oreborsaonline.ilsole24ore.com/...md=index&chId=43
username: yer
password: man
I thank you in advance for whatever help you can give me.
Subject Author Views Date
Thread download authorized pages via LWP yerman 7504 Mar 12, 2005, 9:25 AM
Thread Re: [yerman] download authorized pages via LWP
Andy 7427 Mar 14, 2005, 2:38 AM
Thread Re: [Andy] download authorized pages via LWP
yerman 7408 Mar 14, 2005, 9:44 AM
Post Re: [yerman] download authorized pages via LWP
Andy 7406 Mar 14, 2005, 9:55 AM
Thread Re: [yerman] download authorized pages via LWP
dan 7385 Mar 14, 2005, 10:36 AM
Post Re: [dan] download authorized pages via LWP
yerman 7333 Mar 16, 2005, 6:19 AM