Reputation: 284
I am trying to scrape an ASPX page with Perl's WWW::Mechanize module. The page sends some cookie which I would like to store and send in subsequent requests. So how we can store the cookies using this module?
Upvotes: 1
Views: 246
Reputation: 10666
As revolet said WWW::Mechanize works with Cookies automatically. But if by "store" you mean save cookies to the file you can use this code:
$mech->cookie_jar->save( $cookie_filename );
And you can load these cookies in another app by reading your cookie file:
$mech->cookie_jar->load( $cookie_filename );
Upvotes: 1
Reputation: 58
According to the documentation, WWW::Mechanize should handle cookies for you automatically if you use the same instance across multiple requests.
Can you let us know what kind of issues have come up with your approach?
Upvotes: 3