For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2007 > Unable to post to https









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 Unable to post to https
Rodrick Brown

2007-07-20, 7:02 pm


Is there anything special need to post to https sites?

The page has a few lines of java script and the following html=20

------ html form --------
<form name=3D=22loginForm=22 action=3D=22j_security_check=22 =
method=3D=22post=22>
=2E..
=2E..
<tr>
<td class=3D=22loginLabel=22><label for=3D=22tUser=22
accesskey=3D=22U=22><span class=3D=22underline=22>U</span>ser
Name: </label></td>
<td class=3D=22loginValue=22><input type=3D=22text=22 =
id=3D=22tUser=22
name=3D=22j_username=22></td>
</tr>
<tr>
<td class=3D=22loginLabel=22><label for=3D=22tPassword=22
accesskey=3D=22P=22><span
class=3D=22underline=22>P</span>assword: </label></td>
<td class=3D=22loginValue=22><input type=3D=22password=22
id=3D=22tPassword=22 name=3D=22j_password=22 maxlength=3D=2250=22></td>
</tr>
------- end ----

use strict;
use warnings;
use Data::Dumper;
use LWP 5.64;
my =24browser =3D LWP::UserAgent->new;

my =24user =3D 'username';
my =24pass =3D 'password';

My =24url =3D 'https://secure-site/j_security_check';
my =24response =3D =24browser->post( =24url,
=5B j_username =3D> =24user,
j_password =3D> =24pass
=5D
);
die =22=24url error: =22, =24response->status_line
unless =24response->is_success;
die =22Weird content type at =24url -- =22, =24response->content_type
unless =24response->content_type eq 'text/html';

if( =24response->content =3D=7E m=7B(Incorrect user name or password)=7D) =
=7B
print =241,=22=5Cn=22;
=7D
elsif( =24response->content =3D=7E m=7B(My Customers)=7D ) =7B
print =22login successfull returning data:=5Cn=22;
sleep 2;
print =24response->content;
=7D else =7B
print =22problem trying to access =24url: =24=21=5Cn=22;
=7D

No matter what I keep getting the following:=20
https://secure-site/j_security_check error: 408 Request Timeout at
foo.pl line 17=20


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - =
- - - - - - -

This message is intended only for the personal and confidential use of the =
designated recipient(s) named above. If you are not the intended =
recipient of this message you are hereby notified that any review, =
dissemination, distribution or copying of this message is strictly =
prohibited. This communication is for information purposes only and =
should not be regarded as an offer to sell or as a solicitation of an =
offer to buy any financial product, an official confirmation of any =
transaction, or as an official statement of Lehman Brothers. Email =
transmission cannot be guaranteed to be secure or error-free. Therefore, =
we do not represent that this information is complete or accurate and it =
should not be relied upon as such. All information is subject to change =
without notice.

--------
IRS Circular 230 Disclosure:
Please be advised that any discussion of U.S. tax matters contained within =
this communication (including any attachments) is not intended or written =
to be used and cannot be used for the purpose of (i) avoiding U.S. tax =
related penalties or (ii) promoting, marketing or recommending to another =
party any transaction or matter addressed herein.


Tom Phoenix

2007-07-20, 7:02 pm

On 7/20/07, Brown, Rodrick <rodrick.brown@lehman.com> wrote:

> No matter what I keep getting the following:
> https://secure-site/j_security_check error: 408 Request Timeout at
> foo.pl line 17


If a browser can reach the site, but your LWP code can't, you almost
certainly need to change your LWP code to do the same thing the
browser is doing. The best way may be if you can set up a "middleman"
program (such as a proxy) which can track the details of the
transaction and see what the browser is doing that your code doesn't
do. That can be difficult when using https protocol, though. Another
way is to use LWP's debugging facilities to monitor the transaction at
a lower level.

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training
Sponsored Links







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

Copyright 2009 codecomments.com