in reply to Crypt::SSLeay performing a HTTP POST

I suppose you mean using Crypt:SSLeay via LWP:

#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $resp = $ua->post( "https://www.website.ws/members/index.dhtml", [ userid => 'foo', pwd => 'bar', language => 'english', form => 1, page => '', func => '', pagedrop => '', ] ); if ($resp->is_success) { print $resp->decoded_content; } else { print $resp->status_line; }
$ ./843152.pl | grep login-error <p class="login-error">Too many login attempts.<BR>Please contact Cust +omer Service at (1) 760-602-3000, M-F, 8:00 am - 5:00 pm, PST.</p> $ strace -eopen ./843152.pl 2>&1 | grep Crypt/SSLeay.pm open("/usr/lib/perl5/Crypt/SSLeay.pm", O_RDONLY) = 4

Replies are listed 'Best First'.
Re^2: Crypt::SSLeay performing a HTTP POST
by kbarker (Initiate) on Jun 04, 2010 at 17:08 UTC

    Thanks. I do not see a use Crypt::SSLeay line. Is there a clear definition of the parameters to be passed in the post. I understand it will be dependent upon the number of fields on the page to complete, but I am confused on what other parameters are required versus optional. For example - language.

      I do not see a use Crypt::SSLeay line.

      That's why I supplied the strace as 'proof' :) — Crypt::SSLeay is loaded automatically for HTTPS requests.

      Is there a clear definition of the parameters to be passed in the post...

      That's entirely site/URI-dependent. I just made a request using Firefox and traced it using the "Live HTTP Headers" addon to see what's being sent.

        So how dows LWP know to use Crypt::SSLeay? Becasue of the HTTPS in the URL? How does it know how to find my openSSL DDL files? I did add the square brackets.

        Thanks! I think I am starting to understand. Below is my code. It hangs during the post and I am sure that it is incorrect, but do not know why. In poking around the documentation, it shows the URL:PORT which in my case is 443. I am believing that LWP is actually attempting a HTTP post to the URL on port 443 - but I need it to do a HTTPS post. I believe this because when I open a browser with the same URL:443, it hangs as well. I installed OpenSSL to its own directory, but see no mention that it is being accessed via LWP.

        require 'c:\ken2\config.pl'; use strict; use warnings; use LWP::UserAgent; use Crypt::SSLeay; my $url = "https://secure_URL_here/"; print "$url\n"; my $port = 443; my $lwp = LWP::UserAgent->new( ); print "here\n"; my $response = $lwp->post("$url:443", DATA=>our $USER, DATA=>our $PASS + ); if($response->is_success){ print $response->content; } else{ print $response->status_line, "\n"; }