Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: LWP::Simple - cookies?

by cacharbe (Curate)
on Sep 27, 2001 at 21:59 UTC ( [id://115190]=note: print w/replies, xml ) Need Help??


in reply to LWP::Simple - cookies?

Yes, you should be looking at:
It isn't actually that hard. Here is something I use with frequency lately.
##Assumes: use LWP::UserAgent; use HTTP::Request::Common qw(POST); use HTTP::Cookies; sub CreateSession{ ##Takes Ref to user agent object my ($ua) = @_; $$ua->cookie_jar(HTTP::Cookies->new(file => "<FILEPATH>", autosave => 1)); $$ua->proxy(http => '<PROXYINFO - OPTIONAL>'); $$ua->timeout(300); #Use some basic Authentication my $req = POST 'https://<SOME SITE>/login.cgi', [cdsid=>'<USERID>', pw=>'<PASSWORD>',back=>'<BACK>']; $req->proxy_authorization_basic('<PROXY USERID>, <PROXY PASS>); my $res = $$ua->request($req); unless ($res->is_success) { print "Login Failed: : ". $res->status_line . "\n"; } #get the next page $req = POST 'https://<NEXT PAGE>/main1.cgi'; $res = $$ua->request($req); unless ($res->is_success) { print "Main Page Failed: : ". $res->status_line . "\n"; } return 1; }

C-.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-03-19 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found