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; }
In reply to Problem with SSL connection to PayPal by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |