Handshake failure in ios push notification

I want to send push notification to Ios device and here is my code,

 $ctx = stream_context_create();
 stream_context_set_option($ctx, 'ssl', 'local_cert',
 ABSPATH.'apns-dev.pem');
 stream_context_set_option($ctx, 'ssl', 'passphrase', $password);


 $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', 
 $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT,
 $ctx);

 if (!$fp)
      exit("Failed to connect: $err $errstr" . PHP_EOL);

 echo 'Connected to APNS' . PHP_EOL;
 $payload = $message;
 foreach ($token as $deviceToken)
 {

 $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
 }
 $result = fwrite($fp, $msg, strlen($msg));
 if (!$result)
     echo 'Message not delivered' . PHP_EOL;
 else
     echo 'Message successfully delivered' . PHP_EOL;


 fclose($fp);

      

But I got errors like:

  • stream_socket_client (): SSL operation failed with code 1. OpenSSL error messages:
    Error: 14094410: SSL routines: ssl3_read_bytes: sslv3 failed handshake.
  • stream_socket_client (): unable to connect to ssl: //gateway.push.apple.com: 2195 (Unknown error)
  • stream_socket_client (): Failed to enable cryptography

How to solve this problem?

+3
ios apple-push-notifications


source to share


No one has answered this question yet

Check out similar questions:

6
PHP cannot connect to socket with Apple notification gateway
4
notification connection error
4
push notification in ios
2
iOS - Push Notifications, SSL Connection Error to Apple APNS Server
1
IOS push notifications work locally but not on bluehost
1
Problem with Push Push (APNS)
1
Push notifications from Linux to iOS apps over SSL with PHP
0
Error in Push Notification on Distribution
0
IOS push notifications - refusal to confirm
-1
I am getting an error for sending push for IOS



All Articles
Loading...
X
Show
Funny
Dev
Pics