Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How can my script accept cookies?

by Daddio (Chaplain)
on May 15, 2001 at 05:23 UTC ( [id://80427]=note: print w/replies, xml ) Need Help??


in reply to How can my script accept cookies?

Admittedly, I don't have a whole lot of experience with cookies, especially in the manner you are working here. But, to summarize, here is what the LWP::UserAgent has to say about cookies:

$ua->cookie_jar([$cookies]) # Get/set the HTTP::Cookies object to use. The default # is to have no cookie_jar, i.e. never automatically add # "Cookie" headers to the requests.

In the LWP CookBook (man lwpcook), I found this (and it has some examples):

COOKIES Some sites like to play games with cookies. By default LWP ignores cookies provided by the servers it visits. LWP will collect cookies and respond to cookie requests if you set up a cookie jar. use LWP::UserAgent; use HTTP::Cookies; $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt", autosave => 1)); # and then send requests just as you used to do $res = $ua->request(HTTP::Request->new(GET => "http://www.yahoo.no") +); print $res->status_line, "\n"; As you visit sites that send you cookies to keep, then the file lwpcookies.txt" will grow.

I don't know how much that will help since I can't give you any examples of my own, but I thought I would post it anyway. I have found reading the lwpcook and LWP::UserAgent documentation helpful in what I have done with LWP, so I recommend reading it if you haven't already.

D a d d i o

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found