Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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

by Anonymous Monk
on May 08, 2007 at 13:32 UTC ( #614135=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 with 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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2021-05-12 08:26 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (125 votes). Check out past polls.