小编Joe*_*Joe的帖子

如何使用TLS和PHP发送iOS推送通知?

我的应用程序仍在开发中,我使用本教程使用PHP和SSL发送iOS推送通知.

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

它正在运行但最近被折旧,因为Apple最近决定放弃SSL立即影响开发中的所有应用程序,生产中的应用程序将在10月29日之前更改其代码.

我想知道如何使用TLS而不是SSL来做同样的事情.

这是我以前工作的php看起来像:

$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);
Run Code Online (Sandbox Code Playgroud)

我尝试添加一个Entrust证书,因为Apple建议:

$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);
Run Code Online (Sandbox Code Playgroud)

但它仍然无效.你有什么建议来解决它吗?

php ssl notifications push

6
推荐指数
1
解决办法
6223
查看次数

标签 统计

notifications ×1

php ×1

push ×1

ssl ×1