Level 53
Have you gone through the certificate setup of fcm ?
https://firebase.google.com/docs/cloud-messaging/ios/certs
What is the result you are getting when sending an iOS push notification?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Trying to figure out why push notification doesn't work in iOS. Here is the code of push notification.It works fine in Android. Can you please help me ?
public function notification($token, $load, $type = NULL) { $url = 'https://fcm.googleapis.com/fcm/send';
$fields = array(
'registration_ids' => $token,
'data' => $load
);
// 'notification' => $load
$headers = array(
'Authorization:key=********************',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// echo json_encode($fields);
$result = curl_exec($ch);
echo curl_error($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
return $result;
}
Please or to participate in this conversation.