Open Source Development Tutorials | Newsletter Signup | About Us
Search  

Go Back   Open Source Tutorials Forum > Programming Languages > Perl Programming
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-29-2007, 07:04 AM
powersakthi powersakthi is offline
Junior Member
 
Join Date: Aug 2007
Posts: 1 powersakthi is on a distinguished road
Exclamation LWP::UserAgent Get a page after authenicating SSL

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

use strict;
use warnings;
use LWP::UserAgent;
use HTML::TreeBuilder;

my $ua = LWP::UserAgent->new( agent => 'Mozilla/5.0' );

my $response1 = $ua->post(
'https://secure.server.com/login.asp ', [
"user_id" => "anonymous",
"user_pwd" => "password",
]
);

my $response = $ua->post(
'https://secure.server.com/data.asp', [
"tx_Sno" => "T450W34990",
]
);
print $response->status_line;
print $response1->status_line;
print $response->content;
print $response1->content;

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...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 06:05 PM.


Powered by: vBulletin Version 3.0.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright 2004 - 2006 GrindingGears.com. All Rights Reserved.