Subject: | submit_form fail |
I'm just going to post the same question I posted on perlmonks... it
should have most of the detail... I'm going to run some more with
lwp::debug and see if i can come up with a more specific bug... thanks.
Hi,
I've run into a strange problem. I've tested this code on 3 boxes:
Linux Testing Server:
debian sarge
PERL 5.8.4-8sarge3
libwww-perl 5.803-4
www-mechanize 1.12-2
crypt-ssleay 0.51-3
W32 Testing Server:
XP PRO 2002 SP2
ActiveState PERL v5.8.6 built for MSWin32-x86-multi-thread
libwww-perl 5.801
www-mechanize 0.72
crypt-ssleay 0.51
Client's Server:
XP PRO 2002 SP2
ActiveState PERL 5.8.0 built for MSWin32-x86-multi-thread
libwww-perl 5.68
www-mechanize 0.72
crypt-ssleay 0.51
It works everywhere except of course the client's server... While
debugging I've found that everything works up until this request:
$mech->submit_form( form_number => 1, fields => { 'password' =>
$self->{password} }, );
[download]
After that request $mech->uri returns the same url as before the
request, but $mech->content(...) is empty. The strange part is that this
works fine and they are both very similar https posts:
$mech->submit_form( form_name => 'login', fields => {
'input-login-email' => $self->{account}, 'password' + =>
$self->{password} }, );
[download]
I've tried everything I can think of to get it working... Using:
**************
$mech->field(...info...);
$mech->click();
**************
$mech->submit(...info...);
**************
$mech->request( $request); # with a proper post request...
**************
And 100 other variations.
**************
They all work on the testing servers, but not the production... I tried
using regular LWP requests to get through the security before I even
started using WWW:Mechanize, I couldn't even get that working on the
testing servers. This is not my first rodeo, but I'm stumped. All I can
think of is that the LWP version is breaking the code. Anybody else have
any other ideas? Upgrading PERL/LWP can only happen as a last resort.
Here is a snippet of the relevant parts of the offending code:
if ($self->{location} eq 'us'){ login_us($self) unless
$self->{logged_in};
$mech->get('https://s1.amazon.com/exec/varzea/subst/your-account/m
+anage-your-seller-account.html/ref=ya_hp_az_2/'); } elsif
($self->{location} eq 'uk'){ login_uk($self) unless $self->{logged_in};
$mech->get('http://s1.amazon.co.uk/exec/varzea/subst/your-account/
+manage-your-seller-account.html/ref=ya_hp_az_2/'); }
$mech->follow_link(text_regex => qr/View your Amazon Payments account
+and billing history/i); $mech->follow_link(text_regex => qr/View your
Amazon Payments account +summary/i); $mech->submit_form( form_number =>
1, fields => { 'password' => $self->{password} }, );
$mech->follow_link(url_regex => qr/vg=1&ve=6&vf=4/i); sub login_us{ my
$self = shift; print "Performing US LOGIN...\n";
$mech->get('http://www.amazon.com/'); $mech->follow_link(text_regex =>
qr/your account/i); $mech->follow_link(text_regex => qr/Your seller
account/i); $mech->submit_form( form_name => 'login', fields => {
'input-login-email' => $self->{account}, 'p +assword' =>
$self->{password} }, ); $self->{logged_in} = 1; return
$mech->content(base_href => [undef]); }