Prashanth Sethalli has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Frieds, I am very new to perl world, i am writing a perl script to login in to page which expects username and password and after login in read the content of the next page. i have been getting the Authorisation failed message for the below code, please help the same user name and password works well in the browser Obviously i have removed username and password in the below code
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; my $user=""; my $pass=""; my $url="http://news.bankofamerica.com/EOS/EosDispatcher"; # define user agent my $ua=LWP::UserAgent->new(); $ua->agent("USER/AGENT/IDENTIFICATION"); # make request my $request=HTTP::Request->new(GET=>$url) or die "request failed : $!" +; # authenticate $request->authorization_basic($user,$pass) or die "Authorisation faile +d : $!"; # expect response my $response= $ua->request($request); print $response->content();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Logon Faied
by davido (Cardinal) on Feb 28, 2014 at 14:59 UTC | |
|
Re: Logon Faied
by Anonymous Monk on Mar 01, 2014 at 02:34 UTC | |
by Prashanth Sethalli (Initiate) on Mar 03, 2014 at 16:26 UTC | |
|
Re: Logon Faied
by locked_user sundialsvc4 (Abbot) on Feb 28, 2014 at 18:20 UTC |