Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Those are the only parameters to be passed.$url->query_form( artist => $pm_user, albumcode => $pm_password);
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use URI::URL; use HTTP::Cookies; # put your perlmonks username and password here my $pm_user=''; my $pm_password=''; #instantiate new user agent my $WWWAgent = new LWP::UserAgent(); # attach cookiejar to user agent my $co=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1); $WWWAgent->cookie_jar($co); # build request to simulate login my $url=new URI::URL 'http://www.genesisreports.com/genesis/user/login +.asp'; $url->query_form( artist => $pm_user, albumcode => $pm_password); my $WWWRequest = new HTTP::Request 'GET', $url->as_string() ; # submit request my $WWWResult = $WWWAgent->request($WWWRequest); open (FH, ">D:\\Mustafa\\Perl\\Code\\dm.html") || die "Can't open file to write\n"; print FH $WWWResult->content if ($WWWResult->is_success); close(FH); die "Error logging in $WWWResult->code $WWWResult->message" if(!$WWWResult->is_success); #Get the login page content to test $url=new URI::URL 'http://www.genesisreports.com/genesis/user/mypage.a +sp'; $WWWRequest = new HTTP::Request 'GET', $url->as_string() ; # submit request $WWWResult = $WWWAgent->request($WWWRequest); open (FH, ">D:\\Mustafa\\Perl\\Code\\dm1.html") || die "Can't open file to write\n"; print FH $WWWResult->content if ($WWWResult->is_success); close(FH); die "Error adding to nodelet $WWWResult->code $WWWResult->message" if(!$WWWResult->is_success);
Edit: chipmunk 2001-05-15
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing protected documents again
by Anonymous Monk on May 15, 2001 at 19:42 UTC | |
|
Re: Accessing protected documents again
by Anonymous Monk on May 15, 2001 at 20:11 UTC | |
by mak (Initiate) on May 15, 2001 at 20:42 UTC |