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 ( #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-.


Comment on Re: LWP::Simple - cookies?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-12-20 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls