Search code examples
phpcurlsslpaypalpaypal-ipn

Why does PayPal intermittently give SSL errors?


I'm using PayPal to take payments on my website.

30% of IPNs bail out with the following cURL error. It works fine the other 70% of the time.

Unknown SSL protocol error in connection to www.paypal.com:443

I've tried using SSLv3 to no avail.

Here are my PHP cURL settings, based on Micah Carrick's IPN listener script.

<?php 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__)."/cert/api_cert_chain.crt");
curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr/' );
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);

Solution

  • Not sure. We're not seeing anything on our end.
    Can you change your 'CURLOPT_URL' to https://ipnpb.paypal.com/cgi-bin/webscr and try with that for a little bit?