【问题标题】:Execute Apple Push Notification Server (PHP) from Android Device using "PHP for Android"使用“PHP for Android”从 Android 设备执行 Apple Push Notification Server (PHP)
【发布时间】:2011-08-05 19:23:09
【问题描述】:

我最近下载并安装了“Android 版 PHP”。我创建了一个 .php 文件,该文件利用端口 2195 的 SSL 连接。我按照指南编写了一个向 Apple 的 APNS 发送推送通知的 php 服务器,并成功地在我的 Mac 上运行了它。当我将 .php 和 .pem 放到我的 Android 手机上的同一个文件夹中并尝试使用相同的 WIFI 连接运行它时,我收到以下错误消息:

Error:14094410:SSL routines:func(148):reason(1040) in /mnt/sdcard/sl4a/scripts/lot.php on line 19

Warning: stream_socket_client(): Failed to enable crypto in /mnt/sdcard/sl4a/scripts/lot.php on line 19

Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /mnt/sdcard/sl4a/scripts/lot.php on line 19

有没有人知道我该如何解决这个问题? 谢谢!

【问题讨论】:

    标签: php android ssl apple-push-notifications sl4a


    【解决方案1】:

    我的 Windows 桌面出现 SSL 错误,其中一个 PHP 脚本访问了 HTTPS 资源。

    解决方案是启用 openssl 扩展。因此,也许这与您在这里遇到的问题相同,与 PHP for Android 上的 opensll 有关。

    【讨论】:

      【解决方案2】:

      我不知道如何解决它,但 Google 有它自己的推送通知框架。这里有一个例子:http://code.google.com/android/c2dm/

      编辑答案:

      我认为问题很可能与通过 SSL 进行调用所需的证书有关。 PHP for Android 应用程序可能没有访问您需要的安全证书的权限。

      【讨论】:

      • 为了澄清,php 将推送通知发送到 Apple 的注册 iPhone 推送通知服务。
      • 哦,好的。这更有意义。
      • 嗯......这可能是一种可能性。你可能知道我怎样才能解决这个问题吗?我尝试将证书放在我的网站上并尝试从那里调用它,但这似乎不起作用......也许我做错了?
      • 我没有对 PHP 或客户端 SSL 做太多工作,但您可以尝试将代码添加到问题中。您可能会得到更多答案。
      猜你喜欢
      • 2015-04-18
      • 1970-01-01
      • 2015-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多