Dear Monks,
I'm trying to log in to a site using a script. The problem is that I keep getting 500 Can't connect to www.saxobank.com:80 (connect: Unknown error). The strange thing is that I only get this error when trying sites using authentication (which I guess means this is not a proxy issue). I've tried several with the same result. My code is below. The error is generated immediately after the GET request. As far as I can tell the POST works fine. Does anyone know what could be the problem?
#! c:\perl\bin -w use strict; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; use LWP::Debug qw(+); use LWP::Protocol::https; use Crypt::SSLeay; my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => 'cookie_jar', autosave =>1) +); # configure LWP::UserAgent to follow redirects after POST push @{ $ua->requests_redirectable }, 'POST'; my $request=$ua->request( POST "https://www.saxobank.com/Default.aspx/?id=2&Lan=EN&Au=1&Grp=5" +, { __VIEWSTATE => 'dDwtMTE1ODc1NzA2NTs7PjAuMSDgHjTB0rV7byCH14/dWkMm', txtUID => 'myID', txtPWD => 'myPass', submit => 'log in' }); print $request->is_success ? $request->content : "failed\n"; $request= $ua->request(GET "http://www.saxobank.com/?ID=101"); print $request->is_success ? $request->content : $request->status_line +;
-----------------------------------
Any comments about coding style are welcome.In reply to 500 error attempting to log in by dannoura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |