我遵循了这个关于如何发送推送通知的 youtube 教程:https://www.youtube.com/watch?v=_3YlqWWnI6s
当我在我的网络服务器上运行 php 文件时,它超时并给我这个错误。我查看了网络,但我找不到任何问题,有人可以建议我哪里出错了..
[14-Dec-2015 06:13:10 America/New_York] PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home2/sptechno/public_html/Wink/sendPush.php on line 18
最佳答案
当你为 Apple 推送通知运行 .php
文件时。
那时你需要检查 TCP/UDP 端口号是否在你的服务器上打开,否则通知不会传递给苹果服务器。
General Provider Requirements
As a provider you communicate with Apple Push Notification service over a binary interface. This interface is a high-speed, high-capacity interface for providers; it uses a streaming TCP socket design in conjunction with binary content. The binary interface is asynchronous.
The binary interface of the production environment is available through gateway.push.apple.com, port 2195; the binary interface of the development environment is available through gateway.sandbox.push.apple.com, port 2195.
Apple official document for that.
已编辑
检查您的服务器是否已连接到 APNS。
HOSTGATOR:~ Home$ telnet gateway.sandbox.push.apple.com 2195
Trying 17.149.34.143...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
关于php - iOS APN Php 无法连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34265634/