Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I been trying to update my perl cgi script to use SSL when responding to an Instant Payment Notification from PayPal. They provide a test url (tlstest.paypal.com) to test the basic connection to their servers.
Using LWP::UserAgent, I got the following message:
LWP::Protocol::https::Socket: SSL connect attempt failed with unknown error SSL wants a read first at /System/Library/Perl/Extras/5.18/LWP/Protocol/http.pm line 51.
I can easily connect to the host using curl and php, so it isn't a general machine configuration, but it is something specific to perl. Here is the code:
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); $ua->ssl_opts(verify_hostname => 1); $ua->ssl_opts(SSL_ca_file => './MozillaCAFile.crt'); my $host = 'https://tlstest.paypal.com'; my $req = HTTP::Request->new(GET => "$host"); my $res = $ua->get($host); if (not $res->is_success) { print $res->as_string . "\n"; } else { print "Success\n"; print $res->decoded_content; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with SSL connection to PayPal
by hippo (Archbishop) on Jun 26, 2016 at 18:00 UTC | |
by Anonymous Monk on Jun 26, 2016 at 19:43 UTC | |
by hippo (Archbishop) on Jun 26, 2016 at 21:43 UTC | |
by Anonymous Monk on Jun 27, 2016 at 01:01 UTC | |
by hippo (Archbishop) on Jun 27, 2016 at 08:10 UTC | |
by noxxi (Pilgrim) on Jun 27, 2016 at 20:59 UTC | |
|