neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
My expected result was to see the cookies set by the visited URL. However, $cjar appears to be empty. What have I missed?use strict; use warnings; use LWP::UserAgent; use HTTP::Cookies; # .... my declarations snipped ... my $cjar = HTTP::Cookies->new(); my $ua = LWP::UserAgent->new(keep_alive => '1', timeout => $timeout); $url = "http://$host"; $error {public_home} {url} = $url; $req = HTTP::Request->new(GET => $url); $req->content_type('application/x-www-form-urlencoded'); #$cjar->add_cookie_header($req); $t0 = time; $resp = $ua->send_request($req); $t1= time; $error {public_home} {rt} = $t1 - $t0; $ua->cookie_jar($cjar); $cjar->extract_cookies($resp); print $cjar->as_string; exit;
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Missing cookies with LWP::UserAgent and HTTP::Cookies
by borisz (Canon) on Apr 12, 2006 at 18:09 UTC | |
by neilwatson (Priest) on Apr 12, 2006 at 18:34 UTC | |
by borisz (Canon) on Apr 12, 2006 at 18:54 UTC | |
by neilwatson (Priest) on Apr 12, 2006 at 18:58 UTC | |
by borisz (Canon) on Apr 12, 2006 at 19:05 UTC | |
| |
by dataDrone (Acolyte) on Mar 12, 2007 at 21:42 UTC |