How to send iOS Push Notifications using TLS and PHP?

前端 未结 3 740
长情又很酷
长情又很酷 2021-02-04 18:25

My app is still in development and I used this tutorial to send iOS Push Notifications using PHP and SSL.

http://www.raywenderlich.com/32960/apple-push-notification-serv

3条回答
  •  余生分开走
    2021-02-04 19:10

    $ctx = stream_context_create();
    stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
    stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
    stream_context_set_option($ctx, 'ssl', '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);
    

    if you work in a localhost environment don't forget download the certification file entrust_2048_ca.cer

提交回复
热议问题