Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: How do I access a password protected site and access data?

by marto (Archbishop)
on Jun 30, 2005 at 09:05 UTC ( #471255=note: print w/replies, xml ) Need Help??


in reply to Re^4: How do I access a password protected site and access data?
in thread How do I access a password protected site and access data?

Hi,

To get you started I have provided a little example:
#!/usr/bin/perl use strict; use WWW::Mechanize; my $targeturl="http://www.yourdomain.com/login.asp"; my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Windows IE 6' ); $mech->get($targeturl); $mech->success or die $mech->response->status_line; $mech->form_number(1); # if the login form was the first form on the p +age $mech->set_fields( username => "MyUserID", password => "Fak3Pa55w0rd" ); $mech->submit(); print $mech->content(); # print content

I setup an ASP page with a form on it to process the login. The above example logs in and prints out the content of the page following the login.

Hope this helps

Martin

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2018-11-14 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (160 votes). Check out past polls.

    Notices?