The idea is go get to the main page, fill out form with userid and password, and submit it. But, I get redirected instead, output is:use WWW::Mechanize; use HTML::Form; use strict; my ( $content, $mech, $pass, $url, $user ); $user="user\@test.com"; $pass="mypass"; $url = "https://www.test.com". $mech = WWW::Mechanize->new(); push @{ $mech->requests_redirectable }, 'POST'; $mech->redirect_ok(); # get main page. $mech->get($url); die "ERROR(mech): ", $mech->response->status_line unless $mech->succes +s; # fill form with userid/pass and submit my $resp = $mech->submit_form( form_name => 'Login', fields => { USER => "$user", PASSWORD => "$pass" }, ); die "ERROR(resp): ", $resp->response->status_line unless $resp->is_suc +cess; # print output $content = $resp->content; die "ERROR can not get content: ", $mech->status_line unless $resp->is +_success; print $content; exit;
Please help, thanks.<HTML> <!-- File: redirectmeta.html --> <HEAD> <TITLE>Livelink - Redirection</TITLE> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=/livelink815/livelink.exe?R +edirect=1"> </HEAD> </HTML> <!-- End File: redirectmeta.html -->
In reply to WWW::Mechanize form gets redirected by vsevilla
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |