From: | Larry Rosenberg <ljr [...] rosebridge.com> |
Date: | Wed, 26 Nov 2003 14:20:13 -0800 |
To: | bug-WWW-Mechanize [...] rt.cpan.org |
Subject: | Issue with logging into Schwab site |
Hi,
I am able to use WWW::Mechanize to manage my sprint account. So I know
that I am able to deal with https URLs. I also have non-WWW::Mechanize
code that access my Schwab account. However, I do have problems using
WWW::Mechanize to access my Schwab account.
I am failing reading the reply to the login screen when I believe that
I am successful. Here is a little program that fails in the way attached
at the end of this email. Unfortunately, I am not willing to give you my
account number and password. Hopefully, you will have your own Schwab
account that you can use for testing purposes.
Since this is a https request, I cannot eavesdrop using packet snooping
like I could if this were a simple http request. The failure appears to
be that data sent does not match the expected length.
What I am looking for is anyway to debug this or get around this. My
successful Schwab code uses a Netscape cookie jar instead of the vanilla
HTTP cookie jar. Can that matter?
Any hints or suggestions on things I could try would be most appreciate
because I really come to like WWW::Mechanize as it makes my scripts more
robust by hard-coding less into them.
Thanks,
Larry
========================================================================
#! /usr/local/bin/perl -w
# Last Edited: Wed Nov 26 13:54:42 2003
use strict;
use WWW::Mechanize;
my $schwabURL = 'https://investing.schwab.com/trading/signon';
my $browser = new WWW::Mechanize autocheck => 1;
$browser->get($schwabURL) or die "Cannot fetch $schwabURL: $!";
print $browser->uri, "\n";
for my $form ( $browser->forms() ) {
print $form->dump;
print "\n";
}
$browser->submit_form
(
form_name => 'SignonForm',
fields => {
"SignonAccountNumber" => 'acct number',
"SignonPassword" => 'password,
"StartAnchor" => 'QNRSignon'}
);
========================================================================
ljr 1 ) ~/bin/perl/stocks.pl
https://investing.schwab.com/trading/signon
POST https://investing.schwab.com/trading/signon [SignonForm]
SignonAccountNumber=
SignonPassword= (password)
StartAnchor=TradingEQ (option) [*TradingEQ/Stock Trading|OptionStreet/Option Trading|TradeMF/Mutual Fund Trading|MyHomeFromC/My Home|CCBodyi/Account Overview|QNRSignon/Quotes & Research|Balance/Account Balances|Position/Positions|Transaction/History|TradingMOE/Multiple Stock Trades|PositionGainLoss/Performance|OrdScc/Order Status]
SetAsPref=<UNDEF> (checkbox) [*<UNDEF>/off|Yes/ Save this page as your start page ]
<NONAME>=Log In (submit)
PARMS= (hidden)
ShowUN=Yes (hidden)
SANC= (hidden)
SURL= (hidden)
NewsURL= (hidden)
QCdata= (hidden)
page= (hidden)
story= (hidden)
symbols= (hidden)
watch_list= (hidden)
AuthType= (hidden)
Uncaught exception from user code:
Error GETing https://investing.schwab.com/trading/center?: EOF when chunk header expected at /home2/ljr/bin/perl/stocks.pl line 19
WWW::Mechanize::_die('Error ','GET','ing ','URI::https=SCALAR(0x64e998)',': ','EOF when chunk header expected') called at /usr/local/lib/perl5/site_perl/5.8.1/WWW/Mechanize.pm line 1335
WWW::Mechanize::die('WWW::Mechanize=HASH(0x46f524)','Error ','GET','ing ','URI::https=SCALAR(0x64e998)',': ','EOF when chunk header expected') called at /usr/local/lib/perl5/site_perl/5.8.1/WWW/Mechanize.pm line 1104
WWW::Mechanize::request('WWW::Mechanize=HASH(0x46f524)','HTTP::Request=HASH(0x69d2a0)','undef','undef','HTTP::Response=HASH(0x69ffb8)') called at /usr/local/lib/perl5/site_perl/5.8.1/LWP/UserAgent.pm line 516
LWP::UserAgent::request('WWW::Mechanize=HASH(0x46f524)','HTTP::Request=HASH(0x64e710)') called at /usr/local/lib/perl5/site_perl/5.8.1/WWW/Mechanize.pm line 1128
WWW::Mechanize::_make_request('WWW::Mechanize=HASH(0x46f524)','HTTP::Request=HASH(0x64e710)') called at /usr/local/lib/perl5/site_perl/5.8.1/WWW/Mechanize.pm line 1092
WWW::Mechanize::request('WWW::Mechanize=HASH(0x46f524)','HTTP::Request=HASH(0x64e710)') called at /usr/local/lib/perl5/site_perl/5.8.1/WWW/Mechanize.pm line 636
WWW::Mechanize::submit('WWW::Mechanize=HASH(0x46f524)') called at /usr/local/lib/perl5/site_perl/5.8.1/WWW/Mechanize.pm line 705
WWW::Mechanize::submit_form('WWW::Mechanize=HASH(0x46f524)','form_name','SignonForm','fields','HASH(0x4add24)') called at /home2/ljr/bin/perl/stocks.pl line 19
Show quoted text
_________________________________________________________________________
Larry Rosenberg ljr@rosebridge.com
_________________________________________________________________________
Never count your chickens before they rip your lips off