Your form fields are named incorrectly. From the HTML above, you'll need to supply the fields "txtUID" and "txtPWD" for your username as password, respectively. In addition, you also need the hidden form field "__VIEWSTATE", and the "submit" field (named for the submit button). In the code below, I also updated the URL to match that set by the javascript on the web page.
my $request=$ua->request(
POST "https://www.saxobank.com/Default.aspx/?id=2&Lan=EN&Au=0&Grp=0"
+,
{
__VIEWSTATE => 'dDwxOTk0Mzg2NjQzOzs+/+MSvllHQREYBFP5zZXrPV/rhdM=',
txtUID => 'me',
txtPWD => 'secret',
submit => 'log in'
});
It doesn't appear that the "__VIEWSTATE" field has a unique value for each page load, but if it did, you could modify your code to load the home page to retrieve the value for the "__VIEWSTATE" field:
my $viewstate= get_viewstate( $ua ) or die "can't get viewstate field"
+;
+
my $request=$ua->request(
POST "https://www.saxobank.com/Default.aspx/?id=2&Lan=EN&Au=0&Grp=0"
+,
{
__VIEWSTATE => $viewstate,
txtUID => 'me',
txtPWD => 'secret',
submit => 'log in'
});
+
print $request->is_success ? $request->content : "failed\n";
+
# retrieve value for hidden __VIEWSTATE field (unique for each browser
+ load?)
sub get_viewstate {
my $ua= shift;
+
require HTML::TokeParser;
my $request= $ua->request(GET "http://www.saxobank.com/");
die $request->status_line unless $request->is_success;
+
my $p= HTML::TokeParser->new( \$request->content );
+
while( my $tag= $p->get_tag("input") ) {
return $tag->[1]{value} if $tag->[1]{name} eq '__VIEWSTATE';
}
}