in reply to Cookies are not saved to disk
Hi, this code works :)
the flag ignore_discard=>1 will make the cookie jar to save even cookies that are requested to be discarded. So its saved when ignore_discard=>1 means that your program has no bugs, but Google is sending the cookie with a request to discard.#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Cookies; my $cookie_jar = HTTP::Cookies->new(file=>"/var/www/html/images/cookie +.dat", autosave => 1, ignore_discard=>1); #added ignore_discard=>1 my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Ge +cko/20051111 Firefox/1.5"); $ua->cookie_jar( $cookie_jar ); my $KEYWORD_TOOL_URL = "https://adwords.google.com/select/main?cmd=Key +wordSandbox"; my $req = HTTP::Request->new(GET => $KEYWORD_TOOL_URL ); my $res = $ua->request($req); print $cookie_jar->as_string();
Monks, can anybody explain why Google is setting cookie & requesting to discard?
Cheers !
--VC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cookies are not saved to disk
by vc_will_do (Sexton) on Aug 29, 2007 at 14:33 UTC | |
|
Re^2: Cookies are not saved to disk
by Gangabass (Vicar) on Aug 29, 2007 at 15:04 UTC |