How can I get WWW-Mechanize to login to Wells Fargo's website?

Posted by J Miller on Stack Overflow See other posts from Stack Overflow or by J Miller
Published on 2010-04-29T19:34:20Z Indexed on 2010/05/02 19:48 UTC
Read the original article Hit count: 486

Filed under:
|

I am trying to use Perl's WWW::Mechanize to login to my bank and pull transaction information. After logging in through a browser to my bank (Wells Fargo), it briefly displays a temporary web page saying something along the lines of "please wait while we verify your identity". After a few seconds it proceeds to the bank's webpage where I can get my bank data. The only difference is that the URL contains several more "GET" parameters appended to the URL of the temporary page, which only had a sessionID parameter.

I was able to successfully get WWW::Mechanize to login from the login page, but it gets stuck on the temporary page. There is a <meta http-equiv="Refresh"... tag in the header, so I tried $mech->follow_meta_redirect but it didn't get me past that temporary page either.

Any help to get past this would be appreciated. Thanks in advance.

Here is the barebones code that gets me stuck at the temporary page:

#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new();
$mech->agent_alias( 'Linux Mozilla' );

$mech->get( "https://www.wellsfargo.com" );
$mech->submit_form(
    form_number => 2,
    fields => {
        userid => "$userid",
        password => "$password"
    },
    button => "btnSignon"
);

© Stack Overflow or respective owner

Related posts about perl

Related posts about www-mechanize