merhaba arkadaşlar
public static function fcm($title, $message, $notification_ids =""){
$API_ACCESS_KEY='XXXX';
$registrationIds = $notification_ids;
$msg = array
(
'title' => $title,
'body' => $message,
'priority' => 'high',
'channel' => 'xxxx',
'show_in_foreground' => true ,
'opened_from_tray' => false,
);
//for($i=0;$i<count($registrationIds);$i++){
$fields = array
(
'to' => $registrationIds,
'notification' => $msg,
'custom_notification' => $msg,
'message' => $msg,
'data' =>$msg,
'priority' => 'high',
'show_in_foreground' => true ,
'opened_from_tray' => false,
'content_available' => true,
);
$headers = array
(
'Authorization: key=' . $API_ACCESS_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_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch);
if ($result === false) {
// CURL hatası oluştu
$error = curl_error($ch);
echo "CURL Hatası: " . $error;
} else {
echo $result;
}
curl_close($ch);
//}
// echo $result;
} kodum bu eğer $registrationIds değerini tek yollarsam problem olmuyor 1 kullanıcıya bildirim gidiyor ama 5000 kullanıcıya bildirim atacağım bir senaryoda bu kod 5000 kere tekrar tekrar post ediyor. $registrationIds değerlerini json formatında gönderdiğimde ise {"multicast_id":8262453476969306328,"success":0,"f ailure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]} hatası alıyorum nerede hata yaptığım hakkında fikri olan var mı?