in reply to How do I convert this wget to perl?
With LWP::UserAgent, you can specify a "cookie jar" file by doing the following:
# Assumes $ua is an LWP::UserAgent object use HTTP::Cookies; my $cookie_jar = HTTP::Cookies->new( file => "./lwp_cookies.dat", autosave => 1, ); $ua->cookie_jar($cookie_jar);
You can then use the $cookie_jar->add_cookie_header() method to potentially pre-load the cookie jar with the value. You may also be able to do so instead by using the additional arguments of the $lwp->get() method, similar to the following (untested):
$ua->get( $url, ':content_file' => 'file.bin', 'Cookie' => '...', );
Hope that helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I convert this wget to perl?
by Todd Chester (Scribe) on Oct 04, 2015 at 00:44 UTC | |
by Corion (Patriarch) on Oct 04, 2015 at 08:08 UTC | |
by BrowserUk (Patriarch) on Oct 04, 2015 at 02:24 UTC | |
by Todd Chester (Scribe) on Oct 04, 2015 at 07:36 UTC | |
by Corion (Patriarch) on Oct 04, 2015 at 08:05 UTC |