Php Curl Firebase推送:当Firefox关闭时,我得到;“内部服务器错误”;
我使用php发送请求:Php Curl Firebase推送:当Firefox关闭时,我得到;“内部服务器错误”;,php,firebase,curl,firefox,push-notification,Php,Firebase,Curl,Firefox,Push Notification,我使用php发送请求: $fields = array( 'to' => $token, 'data' => [ 'title' => $title, 'body' => $body, 'click_action' => $link, 'icon' => Yii::app()->g
$fields = array(
'to' => $token,
'data' => [
'title' => $title,
'body' => $body,
'click_action' => $link,
'icon' => Yii::app()->getBaseUrl(true).'/files/push_icon.png'
]
);
$fields = json_encode($fields);
$key = 'AAAAhangZXY:APA91 HIDE SOME SYMBOLS';
$headers = array(
'Authorization: key=' . $key,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return [
'curl_response' => $result,
'curl_code' => $httpcode
];
当firefox打开时,响应良好。但是当关闭时,我得到错误“InternalServerError”。然而,当我在那之后打开Firefox时,错误通知将被成功接收
我不知道该如何处理这个错误
还有一个问题:如果我在firefox关闭时发送多条消息,那么当我打开浏览器时,我只会收到一条(最后一条)消息