IIS 服务器上 PHP 中的 Apple 推送通知服务

Posted

技术标签:

【中文标题】IIS 服务器上 PHP 中的 Apple 推送通知服务【英文标题】:Apple push notifications service in PHP on IIS server 【发布时间】:2011-03-09 14:07:33 【问题描述】:

我使用 php 脚本成功地从 apache Web 服务器发送了推送通知。然后我将完整的代码和 html 传输到 IIS。尝试发送推送通知后,我收到以下警告:

Warning (2): stream_socket_client() [http://php.net/function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure [APP\controllers\push_notifications_controller.php, line 79]Code | Context$text   =   "test from hugh"
$apnsHost   =   "gateway.sandbox.push.apple.com"
$apnsPort   =   2195
$apnsCert   =   "../vendors/certificate.pem"
$streamContext  =   resource
$error  =   0
$errorString    =   ""stream_socket_client - [internal], line ??
PushNotificationsController::__send_push_notification() - APP\controllers\push_notifications_controller.php, line 79
PushNotificationsController::index() - APP\controllers\push_notifications_controller.php, line 58
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
require - APP\webroot\index.php, line 83
[main] - CORE\index.php, line 55

我认为 certificate.pem 文件有问题,或者 IIS 处理 ssl 的方式有问题。你能帮忙吗?

【问题讨论】:

【参考方案1】:

您首先需要确保防火墙上的端口(2195 和 2196)已打开。

还有:Error Using PHP for iPhone APNS

【讨论】:

以上是关于IIS 服务器上 PHP 中的 Apple 推送通知服务的主要内容,如果未能解决你的问题,请参考以下文章

Apple 推送通知 - 提供给包裹的凭据未被识别

如何使用 PHP 中的推送通知更新 Apple Wallet 通行证

用于 APSN 的 PHP 推送服务器(Apple)

在 Apple Watch 模拟器上推送通知

使用 PHP 的 Apple 推送通知反馈服务 - 套接字错误

Apple 推送通知令牌