I am trying to write a fairly complex spider which does a lot of client side parsing. I have to go through 3 pages, each page sets a different cookie and I am only allowed access when all three cookies are set.
I know how to parse HTML and get the next parameter set out. But, how do I add a new cookie manually to the cookie jar? In the actual app, this is done using Javascript, which I can't use with LWP, of course
For instance, I need to add a cookie with the following key value pair:
TR=xxxxxxxxxxxxxxxxxxxxxxxx (where the xxx represent a long session number which I've scraped from the previous page)
I define a cookie jar as a new instance of HTTP::Cookies. Using the perldoc, I see that I need to call "set_cookie" (with 6 parameters, most of which make no sense to me. I just want a key value pair to be set in the cookie. I tried adding the path and domain parameters, with no luck). This seems to silently fail, so I can't proceed any further. Does anyone have a snippet of code which manually adds a cookie t o a cookie jar that they'd not mind sharing ?
Thanks in advance
In reply to Setting cookies manually by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |