How to send iOS Push Notifications using TLS and PHP?

前端 未结 3 741
长情又很酷
长情又很酷 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:22

     array("alert" => $message, "badge" => 4, "sound" => 'default', "code" => 200));
    $data = json_encode($content);
    
    foreach ($deviceToken as $token) {
        $msg = chr(0) . pack("n", 32) . pack("H*", $token) . pack("n", strlen($data)) . $data;
        fwrite($fp, $msg);
        fflush($fp);
    }
    
    fclose($fp);
    

提交回复
热议问题