New APNS Provider API and PHP

前端 未结 7 1210
余生分开走
余生分开走 2020-12-08 01:10

I started creating some code based upon this for sending push notifications from PHP.

However now that I have understood there is a new API which utilizes HTTP/2 and

7条回答
  •  醉梦人生
    2020-12-08 01:56

    yes, it's possible:

    $errno=0;$errstr="";
    $sock = stream_socket_client(
      "api.push.apple.com:443",
      $errno,
      $errstr,
      4,
      STREAM_CLIENT_CONNECT,
      stream_context_create(["ssl" => ["local_cert" => "/path/to/cert.pem","verify_peer"=>false,"verify_peer_name"=>false]])
    );
    stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
    

提交回复
热议问题