473,511 Members | 15,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

5 New Member
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
3 2170
KevinADC
4,059 Recognized Expert Specialist
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
1,089 Recognized Expert Top Contributor
Yes. Uninterested in cross forum posts.

- Miller
Aug 29 '07 #3
KevinADC
4,059 Recognized Expert Specialist
Make it 4 forums.....
Aug 30 '07 #4

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

Similar topics

9
11796
by: La Jesus | last post by:
Hello - I am new to Perl, so sorry if this is a silly / ultra easy question. I am using LWP::UserAgent to POST a HTTP message to another website, and it works great. However, I can't figure...
1
12632
by: Woogie | last post by:
When running the sample code below without a proxy the GET returns the expected data. When run with the $proxy uncommented the GET returns the content of the login page for the site being...
0
2265
by: Chandra | last post by:
Hello gurus, I am using LWP::Useragent perl module to get a url from the www. Code snippet: #!perl -w use LWP::UserAgent; LWP::Debug::level('+'); $ua = new LWP::UserAgent || die "$!";
1
6793
by: Hal Vaughan | last post by:
I'm trying to access a site with data that needs to be paged through, one page at a time. It won't allow back buttons and you have to use the menu links to get through. In other words, it is run...
2
6074
by: Vinay Gupta | last post by:
Hi, In a Perl to Tcl conversion project, I am planning to use the following Tcl extensions as a replacement for some Perl libraries. My development environment is Windows. Win32::OLE --> "DDE"...
0
2871
by: Playker | last post by:
Hello I have a website on 2 servers. I want to make a script which checks is first server availbale (he often breaks down) and redirects to 1st or 2nd server. Script works well if an error is the...
2
1472
by: haimk63 | last post by:
Hi ! I am beginner in PERL. I would like to know whether the LWP::UserAgent module? can be used in any server that supports PERL. Thanks
4
4224
by: kkamath | last post by:
Hi, I use LWP::UserAgent to automate windows login process. I set the credentials using $ua->credentials("host:port","realm","id","password"); but it fetches only the current page requested. It...
3
3320
by: cketcham | last post by:
All, I have the following code: use 5.010; use LWP::UserAgent; use URI::URL; use LWP::Debug qw(+); my $browser = LWP::UserAgent->new();
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.