设置与APN的基于证书的连接后,我通过php发出了POST请求:
$url = 'api.push.apple.com:2197';
$device_token = '7ef5e713c3c09597b6ac5ed598ee98512e6e67e8a84e3b30a57632947f21704a';
$response = Http::withHeaders([
'method' => 'POST',
'scheme' => 'https',
'path' => '/3/device/' . $device_token,
'host' => 'api.sandbox.push.apple.com',
'apns-push-type' => 'alert',
'apns-expiration' => '0',
'apns-priority' => '10',
'apns-topic' => 'com.charlotte.DaKaRiBao'
])->post($url, ['aps' => ['alert' => 'Hello']]);
var_dump($response);
但是,我得到的结果是:
string(0) ""
我没有收到任何推送到设备的通知。
我确保我的证书可以正常工作。我的php脚本有什么问题吗?还是我应该仔细检查我的证书设置?
谢谢!