相关疑难解决方法(0)

PHP技术查询APNs反馈服务器

有人可以澄清APN(Apple推送通知)所要求的内容吗?

文档说它会在连接完成后立即开始发送.这是否意味着我不fread()对其进行操作?

这是我当前尝试阅读它的代码.我没有放入fread()循环,因为我不知道什么响应表明"没有更多的记录可读",我不想在我的服务器上进行无限循环.

<?php
$apnsCert = 'HOHRO-prod.pem';

$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
stream_context_set_option($streamContext, 'ssl', 'verify_peer', false);

$apns = stream_socket_client('ssl://feedback.push.apple.com:2196', $error, $errorString, 60, STREAM_CLIENT_CONNECT, $streamContext);

echo 'error=' . $error;
echo 'errorString=' . $errorString;


$result = fread($apns, 38);
echo 'result=' . $result;


fclose($apns);
?>
Run Code Online (Sandbox Code Playgroud)

到目前为止,我得到的只是一个空回复.没有错误,所以它是连接.

我不知道null回复是否意味着没有数据,或者我的方法fread()是错误的.

谢谢

php stream fread push-notification apple-push-notifications

30
推荐指数
2
解决办法
3万
查看次数