Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Login into a website with cookies/session id

by johnnywang (Priest)
on Sep 30, 2005 at 22:45 UTC ( [id://496542]=note: print w/replies, xml ) Need Help??


in reply to Login into a website with cookies/session id

WWW::Mechanize, it has everything you need, to enable cookie, do something like:
my $agent = WWW::Mechanize->new(); $agent->cookie_jar(HTTP::Cookies->new);

Replies are listed 'Best First'.
Re^2: Login into a website with cookies/session id
by Anonymous Monk on Sep 30, 2005 at 23:20 UTC
    Thanks for your help. After reading some of the docs on this module it shows how to follow_link as if you were following an HTML link.

    This is a two page form, how do I then submit the information on the next page? Would I just put in the next form code (as seen below)?

    #!/usr/bin/perl use warnings; uses strict; use CGI qw/:standard/; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->submit_form( form_number => 1, fields => { username => 'user' } ); #### # the previous form redirects us to a new page/form. This # should fill out that form the, right? #### $mech->submit_form( form_number => 1, fields => { password => '12345' } ); #### # at this time, cookies should be saved allowing me to use # Mechanize to pull back ANY $url I want on Neopets.com. ####

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found