Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: LWP-Download 401 Authorization Required

by pemungkah (Priest)
on Jun 05, 2012 at 19:11 UTC ( #974529=note: print w/ replies, xml ) Need Help??


in reply to LWP-Download 401 Authorization Required

You may also be running afoul of the fact that LWP doesn't handle cookies itself. It's common that you access a login URL, supplying the username and password via POST; the application returns a cookie, which then must be passed back again when GETting a resource.

HTTP::Cookies should help. From the synopsis:

use HTTP::Cookies; $cookie_jar = HTTP::Cookies->new( file => "$ENV{'HOME'}/lwp_cookies.dat", autosave => 1, ); use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar($cookie_jar);
At this point, the getting and saving of cookies should happen pretty much automatically.


Comment on Re: LWP-Download 401 Authorization Required
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://974529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (17)
As of 2015-07-07 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls