Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Getting Cookies

by kennethk (Monsignor)
on Jul 05, 2013 at 16:51 UTC ( #1042742=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Getting Cookies
in thread Getting Cookies

Firebug, the free Firefox plug-in, makes that easy.

I'd also mention that, instead of storing cookies to disk, you can use Data::Dumper to look at your cookie jar contents.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re^3: Getting Cookies
Re^4: Getting Cookies
by PerlSufi (Pilgrim) on Jul 05, 2013 at 16:59 UTC
    Ty, kennethk. I have been using HTTP live headers. I forgot firebug did that. I actually want my script to get them automatically. I will be using WWW::Mechanize::Firefox to do crawl the site. I need the JSESSIONID to be a part of an HTTP get request.
Re^4: Getting Cookies
by PerlSufi (Pilgrim) on Jul 05, 2013 at 17:25 UTC
    Oh. It turns out that WWW::Mechanize::Firefox doesn't save cookies to the jar? :(

      Have you read WWW::Mechanize::Firefox and HTTP::Cookies::MozRepl?

      What makes you think that HTTP::Cookies would work together with WWW::Mechanize::Firefox and/or that WWW::Mechanize::Firefox would use a cookie jar outside of Firefox?

        Thanks for your response, Corion. It was silly of me to presume.
        I tried the following code with Mechanize::Firefox and won't work to save cookies:
        my $cookie_jar = HTTP::Cookies::MozRepl->new( file => 'C:\path\to\cook +ies.dat', autosave => 1, ignore_discard => 1);
Re^4: Getting Cookies
by Anonymous Monk on Jul 05, 2013 at 20:03 UTC
    Thanks again for recommending the Data::Dumper to get those cookies. I am another step closer to automating the page. Now I think I need to use a regex to match for the JSESSIONID and concatenate it into my get request.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1042742]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-09-19 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (138 votes), past polls