For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > December 2005 > LWP w/ ssl post problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author LWP w/ ssl post problem
Bj

2005-12-09, 7:00 pm

I am trying to get data from a webpage that I need to log into via a
ssl html form. When I try, all I get is the login page html. I have
Crypt:SSLeay (I forget the exact module) installed. Am I doing something
fundamentally wrong here? I would appreciate any help I could get. Thank
you very much! ~Erithid

Snippit from html form:

<form name="frmLogin" method="post" action="login.aspx" id="frmLogin" autocomplete="on">
<input name="txtLoginName" type="text" id="txtLoginName" class="fill_width" />
<input name="txtPassword" type="password" id="txtPassword" class="fill_width" /></td>
<input type="submit" name="cmdLogin" value="Login" id="cmdLogin" title="Click here to attempt to login" class="button" />

my perl code:

use LWP 5.64;
use HTTP::Cookies;
my $browser = LWP::UserAgent->new(agent =>
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461)' ,
'cookie_jar' => {file => "lwpcookies.txt", autosave => 1,ignore_discard => 1}
);

my $id = 'user';
my $pass= 'pass';

my $url = 'https://site.com/login.aspx';
my $response = $browser->post( $url,
[ 'txtLoginName' =>$id,
'txtPassword'=>$pass,
'cmdLogin'=>'Login',
]
);
my $mystring = $response->content;
open(OUT,">webtest.txt");
print OUT $mystring;
close OUT;





Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com