in reply to HTTPS WWW::Mechanize Form Problems
An update:
I've installed all the suggested modules, tried multiple ways to get around this, and I still haven't gotten it to work. It just won't accept the authentication, and takes me to a "username/password wrong" page instead of the next page. To add to the confusion, with my authentication steps, I can go to any page on the website through get($url), but I can't use a form or go to a new page through a link. Once I try, even get($url) stops working. Here's a quick update/simpler version to my code (just looking for a link now instead of a form):
#!usr/bin/perl use strict; use warnings; # left some comments to show what I've tried #require LWP::UserAgent; #require HTTP::Request::Common; #require HTTP::Response; #use Crypt::SSLeay; #use IO::Socket::SSL; #use CGI::Form; #use HTML::Form; use WWW::Mechanize; use MIME::Base64; my $username = 'name'; my $password = 'password'; my $website = "https://www.url.com/"; my @args = ( Authorization => "Basic " . MIME::Base64::encode( $username . ':' . $password )); my $mech = WWW::Mechanize->new( ); $mech->credentials( 'www.url.come','Automated Analyses', $username, $p +assword ); # enabling cookies use HTTP::Cookies; $mech->cookie_jar(HTTP::Cookies->new()); my $url = "https://www.url.com/"; $mech -> get ($url); # getting links my @links = @{$mech->links}; # the 'enter' link on the front page $mech->follow_link(n=> 5); # and this prints the "401 error" page print "\n\n", $mech->content, "\n";
|
|---|