cancel
Showing results for 
Search instead for 
Did you mean: 

E-Mail Notification about TLS 1.2 and current fsockopen integration

Contributor

E-Mail Notification about TLS 1.2 and current fsockopen integration

Hello,

we have received an email from PayPal recently asking us to update our integration to support HTTP 1.1 and TLS 1.2.

I have read through the documentation and our current integration works fine so far.

Nevertheless we get that email saying we have to update our integration.

 

Is there something wrong with our code? Does fsockopen not support TLS 1.2?

 

// Send an empty HTTP 200 OK response to acknowledge receipt of the notification
header('HTTP/1.1 200 OK');

if (empty($_POST))
	exit ;

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value)
{
	$value = urlencode(stripslashes($value));
	$req .= "&$key=$value";
}

// post back to PayPal system to validate
$header = '';
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen('tls://www.paypal.com', 443, $errno, $errstr, 30);
3 REPLIES 3
Highlighted
Moderator

Re: E-Mail Notification about TLS 1.2 and current fsockopen integration

Hi,It's not so much a case of checking your IPN code for the most part. 

 

Your server software would need to be able to support version 1.2 of the TLS protocol. Best approach here is to run your system against the sandbox, if it works as expected then you're good to go. 

 

The sandbox is setup with all the necessary changes and only accepts TLS 1.2 connections at the moment. 

 

Contributor

Re: E-Mail Notification about TLS 1.2 and current fsockopen integration

For future reference:

I struggled with this integration quite a bit. In the end, the fsockopen integration no longer works with the updated TLS requirements and there is no way to make it work, since it doesn't support the setting of SSL parameters.

It also didn't work with the sandbox.

 

Solution: You need to rewrite the code with curl as in the PayPal code examples and updated developers guide.

 

Contributor

Re: E-Mail Notification about TLS 1.2 and current fsockopen integration

Hello Conrad,

 

I'm at exactly the same point that you were on April 20. Would you mind posting your "replacement code" with the cURL solution?

 

All the best,

Martin