Wie sende ich iOS-Push-Benachrichtigungen mit TLS und PHP?

Meine App befindet sich noch in der Entwicklung und ich habe dieses Tutorial verwendet, um iOS-Push-Benachrichtigungen mit PHP und SSL zu senden.

http: //www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-

Es hat funktioniert, wurde aber kürzlich abgeschrieben, da Apple vor kurzem beschlossen hat, SSL zu löschen, was sich sofort auf alle Apps in der Entwicklung und auf Apps in der Produktion auswirkt, die bis zum 29. Oktober ihren Code ändern müssen.

Ich würde gerne wissen, wie man dasselbe mit TLS anstelle von SSL macht.

Hier ist, wie meine PHP-Version aussieht:

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

Ich habe versucht, ein Entrust-Zertifikat hinzuzufügen, wie von Apple vorgeschlagen:

$ctx = stream_context_create();
stream_context_set_option($ctx, 'tls', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'tls', 'passphrase', $passphrase);
stream_context_set_option($ctx, 'tls', 'cafile', 'entrust_2048_ca.cer');
$fp = stream_socket_client('tls://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

Aber es funktioniert immer noch nicht. Haben Sie einen Vorschlag, den Fehler zu beheben?

Antworten auf die Frage(3)

Ihre Antwort auf die Frage