By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

LWP::UserAgent Get a page after authenicating in SSL mode

P: 5
Hi All,
I am using LWP::UserAgent and HTML::TreeBuilder to communicate to the below site
Here is the website map:

https://secure.server.com/index.htm which asks for two fields
user_id
user_pwd
then submit button
the form is submitted to
https://secure.server.com/login.asp
which validates the login credentials and if validated then user is redirected to main.asp and there will be a link called
https://secure.server.com/data.asp
which will have field
tx_Sno
and after typing the serialnumber and hitting submit button the data is POST'ed to data.asp and details like
1) Manufacured_date
2) Model
3) Site .e.t.c comes in a tabular format.

Now the requirement:
I have to write a perl script which will do all these jobs behind the screen using LWP::UserAgent and use HTML::TreeBuilder. Since the site is SSL based i used CRYPT:SSLeay. Now my program looks like this

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use LWP::UserAgent;
  4. use HTML::TreeBuilder;
  5.  
  6. my $ua = LWP::UserAgent->new( agent => 'Mozilla/5.0' );
  7.  
  8. my $response1 = $ua->post('https://secure.server.com/login.asp ', [
  9.     "user_id"  => "anonymous",
  10.     "user_pwd" => "password",
  11. ]);
  12.  
  13. my $response = $ua->post( 'https://secure.server.com/data.asp', [
  14.     "tx_Sno" => "T450W34990",
  15. ]);
  16.     print $response->status_line;
  17.     print $response1->status_line;
  18.     print $response->content;
  19.     print $response1->content;
  20.  
The output is Status ok but the login data.asp is not getting into the session and it returns the response..
<SCRIPT>
parent.document.location.replace('/index.htm');
</SCRIPT>
which means the session created by response1 is not applying to response POST. Can anyone help me how to handle this situation...
Aug 29 '07 #1
Share this Question
Share on Google+
3 Replies


KevinADC
Expert 2.5K+
P: 4,059
hmmm... that makes at least three forums now you have this posted on. I can see posting on a forum and after not getting any replies after a day or two moving on, but this is not the case.
Aug 29 '07 #2

miller
Expert 100+
P: 1,089
Yes. Uninterested in cross forum posts.

- Miller
Aug 29 '07 #3

KevinADC
Expert 2.5K+
P: 4,059
Make it 4 forums.....
Aug 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.