"Tac/Smokescreen Action Network" <[EMAIL PROTECTED]> writes:
> I'm using LWP to access a site that sends several session only cookies.
> Currently, I'm using request_simple, parsing out the header, saving the
> cookies and extracting a 302 Location: header, then calling another
> request_simple to that location, explicitly setting the cookies.
>
> It occurred to me that $ua->request may handle all of this.
$ua->simple_request is the one that actually handle this.
$ua->request handle this because it use $ua->simple_request to do its work.
> How does $ua->request handle cookies -- is there a way to extract the cookies from
> the $response variable?
This will happen automatically if you set up a cookie_jar for the $ua.
> In the event of an redirect (302), will the useragent send the
> cookies it received in the first part of the request?
Yes.
There is one problem though. Some servers send a redirect to the
exact same URI that the first request was aimed at, together with some
Set-Cookie headers. $ua->request() will currently not follow such
redirects, because it think this will be an infinite loop.
> Finally, any cookie code examples would help. I've read the documentation
> on cookie_jar and a litle on HTTP::Cookie, but I'm still stuck.
The 'lwpcook' document also has a little example.
Regards,
Gisle