我想从curl(PHP或Linux)获得Apple推送通知的反馈。 我发现这段代码发送推送通知从Apple推送通知反馈中获取信息
<?php
$url = 'https://feedback.push.apple.com:2196';
$cert = 'Cert.pem';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSLCERT, $cert);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, "passphrase");
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"device_tokens": ["XXXX"], "aps": {"alert": "test message one!"}}');
$curl_scraped_page = curl_exec($ch);
?>
反馈服务
苹果提供你应该偶尔轮询反馈服务。这将提供以前但不再有效的设备控件列表,例如,如果用户卸载了您的iPhone应用程序。然后,您可以从数据库中删除deviceToken,以免与无效设备进行通信。
我需要一个PHP脚本来从Apple反馈服务获取此列表。
感谢
什么是不工作? –
@BasvanStein此代码没有给我任何结果。我只需要从PHP代码获得苹果的反馈 –