J
John
Hello. I have a perl script that uses a LWP::Useragent
to retrieve data from a password protected page. Here is
how I have set the authentication:
my $uagent = new LWP::UserAgent;
$uagent->agent('My Cool Browser');
$uagent->conn_cache(LWP::ConnCache->new());
$uagent->cookie_jar(HTTP::Cookies->new('file'=>cookies1',
'autosave'=>1,));
$uagent->credentials('www.mywebsite.com:80, 'test account', 'john'=>
'john123');
$myurl = 'http://www.mywebsite.com/secret';
$uagent->get($myurl);
print $uagent->content();
The above code works, but after doing a network trace it seems that
the user agent is logging in (HTTP authorization) each time it tries
to access the page (even if the page has been accessed before during
the same program session). A regular web browser does not behave like
this though -- once you log in, it does not try to keep logging in
during the same browser session. My question: is there any way to make
this behave a like a regular browser? Thanks.
John
to retrieve data from a password protected page. Here is
how I have set the authentication:
my $uagent = new LWP::UserAgent;
$uagent->agent('My Cool Browser');
$uagent->conn_cache(LWP::ConnCache->new());
$uagent->cookie_jar(HTTP::Cookies->new('file'=>cookies1',
'autosave'=>1,));
$uagent->credentials('www.mywebsite.com:80, 'test account', 'john'=>
'john123');
$myurl = 'http://www.mywebsite.com/secret';
$uagent->get($myurl);
print $uagent->content();
The above code works, but after doing a network trace it seems that
the user agent is logging in (HTTP authorization) each time it tries
to access the page (even if the page has been accessed before during
the same program session). A regular web browser does not behave like
this though -- once you log in, it does not try to keep logging in
during the same browser session. My question: is there any way to make
this behave a like a regular browser? Thanks.
John