Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Passing a cookie with LWP::UserAgent

by Anonymous Monk
on May 08, 2007 at 13:30 UTC ( [id://614133]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Passing a cookie with LWP::UserAgent
in thread Passing a cookie with LWP::UserAgent

Well, I was trying to do the same thing. Had lots of trouble. Couldn't figure out why until I realized that the file I was trying to initialize wasn't being loaded.
my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies::Netscape->new('file' => '<your cookie f +ile here>' )); my $url = URI->new( '<your URL here>' ); my $response = $ua->request(HTTP::Request->new(GET => $url));
but the above code works. If you follow other examples, you'll end up creating a seperate "cookie jar" and attaching it to your user agent. Just make sure your cookie file is being read because nothing really lets you know it didn't work (I'm sure there is a status or something, but I didn't get into the details and it didn't die or anything on its own).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-24 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found