I am trying to login into an URL using LWP perl
My URL open ups with a pop up asking for username and password.When I try to manually log in ,it succeeds but through LWP,I am getting 401 error
my ($url) = @_;
my $ua = LWP::UserAgent->new( keep_alive => 1, agent => "Mozilla/4.76 " );
push @{ $ua->requests_redirectable }, 'POST';
$ua->cookie_jar( HTTP::Cookies->new( file => "$ENV{HOME}/.cookies.txt" ) );
# timeout:
$ua->timeout(30);
print "\nMaking request to $url\n";
my $request = HTTP::Request->new('GET');
$request->url($url);
my $response = $ua->request($request);
my $user = "weblogic";
my $pwd = "Fusionapps1";
$ua->credentials( $url, "default", $user, $pwd );
#$request->authorization_basic( $user, $pwd );
my $response = $ua->request($request);
if ( $response->is_success ) {
$isLoginSuccessful = 1;
}
}
I have tried with the below thing as well
$request->authorization_basic( $user, $pwd );
ERROR: Error 401--Unauthorized
Kindly help!! Any help will be appreciated