苹果在 php 中使用 APNS 拒绝连接
大家好,我正在使用以下代码
<?php
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'Developck.pem';
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error,$errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
echo($errorString);
?>
,并收到以下警告
警告:stream_socket_client() [function.stream-socket-client]:无法连接到 ssl://gateway.sandbox.push.apple.com:2195(连接被拒绝)在 /home/xxxxxxxxx/public_html/apns1/Push1.php 第 9 行 连接被拒绝
Hi all I am using following code
<?php
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'Developck.pem';
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error,$errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
echo($errorString);
?>
and I get following warning
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection refused) in /home/xxxxxxxxxx/public_html/apns1/Push1.php on line 9
Connection refused
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请查看此处。我认为这会帮助您发送推送通知;-)
Take a look here. I think it will help you sending your Push Notifications ;-)