develooper Front page | perl.libwww | Postings from April 2001

LWP::UserAgent and HTTP::Cookies

Thread Next
Matthew Hesher
April 18, 2001 18:19
LWP::UserAgent and HTTP::Cookies
Message ID:
Can anyone tell me how to change LWP::UserAgents defautlt behavior from
'ignore cookeis' to 'get and set cookies'?  I've written a little script
that looks like this:

$ua = LWP::UserAgent->new;
$cookie_jar = HTTP::Cookies->new;
$request = HTTP::Request->new('GET',
$response = $ua->request($request);
$request = HTTP::Request->new('POST',
$response = $ua->request($request);

After the first request is fulfilled, the cookie-jar is filled with the
cookies received from page1.asp.  I can see this from the first print
statement above.  However, before sending the second message,  print the
headers and  get nothing.  I've tried forcing the heads in there with
'$cookie_jar->add_cookie_header($request)' and if I print the header
after that, the $request header appears to be set with the cookie
received from page1.asp, but page2.asp (which is lookie for the cookie
from page1.asp) says it can't find the cookie.  Can anyone help me
figure out what's going on.  Please email me as I don't have newsgroup
access very often.
Curt Hesher

Curt Hesher

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About