varghees has asked for the wisdom of the Perl Monks concerning the following question:
I tried to access the authenticated page config.cgi using the below code. But I am not able to access them with the authenticated session. I get only the login page at the second request. Somebody please tell me whats wrong in this script.
my $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 "); $url = 'http://localhost/web_authenticate_post.cgi'; $req = HTTP::Request->new(POST => $url); $req->content_type('application/x-www-form-urlencoded'); $req->content('username=security&password=security&login=Login'); my $res=$ua->request($req); if($res->is_success){ $res1 = $ua->request(HTTP::Request->new(GET=>'http://localhost/conf +ig.cgi' )); print $res1->content; } else{ print $res->status_line; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Need to Access one page after authentication in perl
by Anonymous Monk on Jul 12, 2012 at 06:44 UTC | |
Re: Need to Access one page after authentication in perl
by monsoon (Pilgrim) on Jul 12, 2012 at 02:57 UTC | |
Re: Need to Access one page after authentication in perl
by bulk88 (Priest) on Jul 12, 2012 at 04:58 UTC |
Back to
Seekers of Perl Wisdom