Clear questions and runnable code
get the best and fastest answer
Stay logged in between requests with WWW::Mechanizeby Cody Pendant (Prior)
|on Nov 14, 2008 at 00:57 UTC||Need Help??|
Cody Pendant has asked for the
wisdom of the Perl Monks concerning the following question:
I've written a scraper with WWW::Mechanize.
It logs in to a website every time I run it and returns a table of data.
So, now I'm thinking, why does it have to log in every time?
My browser doesn't have to log in every time. There's a timeout of an hour.
I've got this:
in my code, and that file is being written to every time the script runs, but it's empty except for "#LWP-Cookies-1.0" at the top.
There's no "remember me" option on this website, so they're only for-this-session type cookies, but why doesn't Mech save those for me? That way the website would let my script return five minutes later and see it as still logged in, just like it does with my browser.
Maybe there's something about session cookies I don't understand? Any help gratefully received.
Nobody says perl looks like line-noise any more