Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

LWP::UserAgent & HTTP::Cookies

by dkubb (Deacon)
on Jan 18, 2001 at 08:27 UTC ( [id://52736]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Re: lwp::simple basic question about webbing
in thread lwp::simple basic question about webbing

If you are using Netscape, you can use HTTP::Cookies to have your LWP::UserAgent client read and write from your actual Netscape cookie files without needing to cut and paste the cookie string into your code:

#!/usr/bin/perl -w use strict; use HTTP::Cookies; use LWP::UserAgent; #Set path to your Netscape Cookie files my $cookie_jar = HTTP::Cookies::Netscape->new( File => "$ENV{HOME}/.netscape/cookies", AutoSave => 1, ); #Create a User Agent, and tell it to store cookies my $ua = LWP::UserAgent->new; $ua->cookie_jar($cookie_jar); #...

If you aren't using Netscape, then you will have to explicitly set the cookies in the $cookie_jar object, which you can do using the HTTP::Cookies::set_cookie() method.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://52736]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.