Hello here,
I am having issues to connect to 'feedback.push.apple.com:2196' for feedback push notifications. My PHP script has been working perfectly until I have renewed the push notification .pem certificate, but now it gives me this error:
PHP Warning: stream_socket_client(): Failed to enable crypto in myscript.php on line 10
Fact is: the new certificate works because I am able to send out push notifications to my app users, so, where is the problem??!!
Here is the PHP script I am using to connect to the service ( I left out the part working on the returned data which is irrilevant for the connection issue):
$passphrase = 'mypw';
$stream_context = stream_context_create();
stream_context_set_option($stream_context, 'ssl', 'local_cert', '/path/to/mycertificate.pem');
stream_context_set_option($stream_context, 'ssl', 'passphrase', $passphrase);
$apns = stream_socket_client('ssl://feedback.push.apple.com:2196', $errcode, $errstr, 60, STREAM_CLIENT_CONNECT, $stream_context);
if(!$apns) {
echo "ERROR $errcode: $errstr\n";
return;
}
///Read data here...
fclose($apns);
Any ideas are very welcome!
Thanks to everyone in advance.
Fab.