• <tfoot id='NSGkX'></tfoot>
    1. <legend id='NSGkX'><style id='NSGkX'><dir id='NSGkX'><q id='NSGkX'></q></dir></style></legend>

      <i id='NSGkX'><tr id='NSGkX'><dt id='NSGkX'><q id='NSGkX'><span id='NSGkX'><b id='NSGkX'><form id='NSGkX'><ins id='NSGkX'></ins><ul id='NSGkX'></ul><sub id='NSGkX'></sub></form><legend id='NSGkX'></legend><bdo id='NSGkX'><pre id='NSGkX'><center id='NSGkX'></center></pre></bdo></b><th id='NSGkX'></th></span></q></dt></tr></i><div id='NSGkX'><tfoot id='NSGkX'></tfoot><dl id='NSGkX'><fieldset id='NSGkX'></fieldset></dl></div>

      <small id='NSGkX'></small><noframes id='NSGkX'>

        <bdo id='NSGkX'></bdo><ul id='NSGkX'></ul>

        带有 PHP 脚本的 Apple 推送通知服务

        Apple Push Notification Service with PHP Script(带有 PHP 脚本的 Apple 推送通知服务)

        <small id='0l0ej'></small><noframes id='0l0ej'>

        <i id='0l0ej'><tr id='0l0ej'><dt id='0l0ej'><q id='0l0ej'><span id='0l0ej'><b id='0l0ej'><form id='0l0ej'><ins id='0l0ej'></ins><ul id='0l0ej'></ul><sub id='0l0ej'></sub></form><legend id='0l0ej'></legend><bdo id='0l0ej'><pre id='0l0ej'><center id='0l0ej'></center></pre></bdo></b><th id='0l0ej'></th></span></q></dt></tr></i><div id='0l0ej'><tfoot id='0l0ej'></tfoot><dl id='0l0ej'><fieldset id='0l0ej'></fieldset></dl></div>
        <legend id='0l0ej'><style id='0l0ej'><dir id='0l0ej'><q id='0l0ej'></q></dir></style></legend>

                <bdo id='0l0ej'></bdo><ul id='0l0ej'></ul>
                  <tbody id='0l0ej'></tbody>

                1. <tfoot id='0l0ej'></tfoot>
                  本文介绍了带有 PHP 脚本的 Apple 推送通知服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试向我的 iPhone (APNS) 发送推送通知.我读了这个 发布并尝试实施它.所以我所有的证书都很好(正常).

                  I'm trying so send push notifications ton my iPhone (APNS). I read this post and try to implement it. So all my certificates are good (normaly).

                  现在我有了这个 php 脚本:

                  Now I have this php script :

                  $device = '4f30e047 c8c05db9 3fa87e7d ca5325f7 738cb2c0 0b4a02d4 d4329a42 a7128173'; // My iphone deviceToken
                  $payload['aps'] = array('alert' => 'This is the alert text', 'badge' => 1, 'sound' => 'default');
                  $payload['server'] = array('serverId' => $serverId, 'name' => $name);
                  $output = json_encode($payload);
                  
                  $apnsCert = 'apple_push_notification_production.pem';
                  
                  $streamContext = stream_context_create();
                  stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
                  
                  $apns = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
                  
                  $apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $device)) . chr(0) . chr(strlen($payload)) . $payload;
                  fwrite($apns, $apnsMessage);
                  
                  //socket_close($apns); seems to be wrong here ...
                  fclose($apns);

                  当我运行这个脚本时,什么也没有发生.没有错误只是一个空页面,但我的 iPhone 没有收到推送通知......

                  When I run this script nothing happen. no error just an empty page but my iPhone doesn't receive the push notification ...

                  你有什么想法吗?

                  非常感谢!

                  推荐答案

                  设备令牌中没有空格,去掉它们

                  no space in device token, strip them

                  这篇关于带有 PHP 脚本的 Apple 推送通知服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    • <tfoot id='yvi31'></tfoot>
                    • <legend id='yvi31'><style id='yvi31'><dir id='yvi31'><q id='yvi31'></q></dir></style></legend>
                        <bdo id='yvi31'></bdo><ul id='yvi31'></ul>
                          <i id='yvi31'><tr id='yvi31'><dt id='yvi31'><q id='yvi31'><span id='yvi31'><b id='yvi31'><form id='yvi31'><ins id='yvi31'></ins><ul id='yvi31'></ul><sub id='yvi31'></sub></form><legend id='yvi31'></legend><bdo id='yvi31'><pre id='yvi31'><center id='yvi31'></center></pre></bdo></b><th id='yvi31'></th></span></q></dt></tr></i><div id='yvi31'><tfoot id='yvi31'></tfoot><dl id='yvi31'><fieldset id='yvi31'></fieldset></dl></div>

                            <small id='yvi31'></small><noframes id='yvi31'>

                              <tbody id='yvi31'></tbody>