使用“PHP for Android”从 Android 设备执行 Apple 推送通知服务器 (PHP)
我最近下载并安装了“PHP for Android”。我创建了一个 .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
有谁知道如何解决此问题吗? 谢谢!
I recently downloaded and installed "PHP for Android." I created a .php file that utilizes an SSL connection with port 2195. I followed a guide for writing a php server that sends push notifications to Apple's APNS, and SUCCESSfully ran it on my Mac. When I put both the .php and the .pem onto my Android phone in the same folder and tried to run it with the same WIFI connection, I get the following error message:
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
Does anyone have any ideas of how I can fix this?
THANKS!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的 Windows 桌面上出现 SSL 错误,其中 PHP 脚本访问了 HTTPS 资源。
解决方案是启用 openssl 扩展。所以也许这与您在这里遇到的问题相同,与 Php for Android 上的 opensll 有关。
I had the SSL error on my Windows desktop, with a PHP script that accessed a HTTPS resource.
The solution was to enable the openssl extension. So maybe it's the same kind of problem you have here, something related to opensll on Php for Android.
我不知道如何解决它,但谷歌有它自己的推送通知框架。这里有一个示例:http://code.google.com/android/c2dm/
编辑回答:
我认为问题很可能与通过 SSL 进行调用所需的证书有关。适用于 Android 的 PHP 应用程序可能没有访问您所需的安全证书的权限。
I'm not sure how to fix it, but Google has it's own push notification framework. There is an example here: http://code.google.com/android/c2dm/
Edit to Answer:
I think that most likely the problem has to do with the certificates needed to make the call over SSL. It is possible that the PHP for Android app does not have permissions to access security certificates you need.