Re: Unable to post to https

2007-07-20 Thread Tom Phoenix

On 7/20/07, Brown, Rodrick <[EMAIL PROTECTED]> 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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Unable to post to https

2007-07-20 Thread Brown, Rodrick

Is there anything special need to post to https sites?

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

-- html form 

...
...

User
Name: 



Password: 


--- end 

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

my $user = 'username';
my $pass = 'password';

My $url = 'https://secure-site/j_security_check';
my $response = $browser->post( $url,
  [ j_username => $user,
j_password => $pass
  ]
);
die "$url error: ", $response->status_line
  unless $response->is_success;
die "Weird content type at $url -- ", $response->content_type
  unless $response->content_type eq 'text/html';

if( $response->content =~ m{(Incorrect user name or password)}) {
  print $1,"\n";
}
elsif( $response->content =~ m{(My Customers)} ) {
  print "login successfull returning data:\n";
  sleep 2;
  print $response->content;
} else {
  print "problem trying to access $url: $!\n";
 }

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


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - -

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.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/