Hi, this code works :)

#!/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();
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.

Monks, can anybody explain why Google is setting cookie & requesting to discard?

Cheers !

--VC



There are three sides to any argument.....
your side, my side and the right side.


In reply to Re: Cookies are not saved to disk by atemon
in thread Cookies are not saved to disk by Gangabass

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.