WWW::Mechanize will follow redirects but won't execute JavaScript. If your redirects are occuring as a result of JavaScript execution, you'll need to write code to read the JavaScript, find the next URL, and do a ->get() on the new URL to get it to skip past that stuff. | [reply] |
I think WWW::Mechanize automatically follows HTTP redirects, if not, you can subclass WWW::Mechanize to override the redirect_ok() subroutine. Also, since WWW::Mechanize is itself a subclass of LWP::UserAgent, it might help to set max_redirect() to some higher value, and/or set request_redirectable(). see the LWP::UserAgent documentation.
package My::Mech;
# My::Mech is a subclass of WWW::Mechanize
use base qw(WWW::Mechanize);
# always allow redirects, irrespective of
# request_redirectable
sub redirect_ok {
return 1;
}
However, your bank's website might use META tags or javascript for "redirects". If so, you have to do the redirection yourself. Depending on the exact format of the page, you could get away with a simple regex, or maybe you need an HTML::Parser to find the redirection URL.
| [reply] [d/l] |