Bir*_*chi 12 php sockets stream ssl-certificate
我正在使用证书和私钥
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $certfile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $pass);
$fp = stream_socket_client('ssl://gateway.xyz.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
Run Code Online (Sandbox Code Playgroud)
它在我的本地XAMPP服务器上运行,但它不能在外部服务器上运行:
警告:stream_socket_client()[function.stream-socket-client]:无法连接到/home/biranchi/public_html/push.php中的ssl://gateway.sandbox.push.apple.com:2195(连接超时)在第42行
无法连接110
错误是什么?我是否需要更改服务器中的某些设置?
pal*_*aja 18
我通过打开生产服务器上的端口2195解决了这个问题.您可以通过以下命令验证$ telnet gateway.push.apple.com 2195
-bash-3.2# telnet gateway.push.apple.com 2195
Trying 17.149.38.141...
Connected to gateway.push.apple.com (17.149.38.141).
Escape character is '^]'.
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)
检查您的个人防火墙设置并确保您没有阻止它。尝试禁用防火墙。
此外,一些 API 喜欢来自实际域而不是桌面的请求。我没有理由相信 Apple 是这样工作的,但这也是需要检查的。
还要确保 ping gateway.sandbox.push.apple.com 并确保您有良好的连接。