SLUG Mailing List Archives
Re: [SLUG] Perl and LWP::UserAgent With Cookies Support
- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] Perl and LWP::UserAgent With Cookies Support
- From: Gavin Carr <gavin@xxxxxxxxxxxxxxxxx>
- Date: Thu Dec 5 09:37:03 2002
- Organisation: Open Fusion
- User-agent: Mutt/1.3.27i
On Wed, Dec 04, 2002 at 11:10:16PM +1100, LS wrote:
> I actually was able to fetch the html pages
> that the php script generates after login in.
> I can also submit to forms within the admin area
> and capture the resulting html sent from the
> php script.
> The solution I used before your email is simply:
> $cookie_jar = HTTP::Cookies->new();
> $browser->cookie_jar( $cookie_jar );
This is fine. The only difference is that your cookie jar's only in
memory, so it's not persistent across sessions.
> With yours below:
> $browser->cookie_jar(HTTP::Cookies->new(file => 'cookies.txt',
> autosave => 1,
> ignore_discard => 1));
> Is it safe to use "autosave" ?
I believe so - it's just saving your cookies to the file you specify on
exit, subject to all the normal permissions and things.
> Another question, when do we actually use the authentication one (the one
> that specifies username, password, realm etc ...) ?
The authentication what? LWP? You need to setup basic authentication if
the site you're accessing requires it (you get the popup username/
password window). But many sites use form-based logins and cookies or
url-based session instead, since basic authentication has a number of
limitations and relatively low security.
Open Fusion P/L - Open Source Business Solutions [ Linux - Perl - Apache ]
- Fashion is a variable, but style is a constant - Programming Perl