Merhaba,
Php de flutter projeesine curl ile bildirim göndermeye çalışıyorum. Sürekli InvalidRegistration hatası alıyorum. Yardımcı olabilecek var mı?
{"multicast_id":4226262067472702987,"success":0,"f ailure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
$api_key="AAAAydjeNKA:APA91bH_HOMSA4eWYiEDFS_rSOiN05-DKu9Sal3cw0I2tSc2kE1NrwBx6tPVAsqd_2aTo_57iJ6GwTUwF8abcgh7mKX5loBvpB5GZF9jv4g6ZbqRtHbDXPzW6OcmbO";
$url="https://fcm.googleapis.com/fcm/send";
$data=array(
'title'=>'Greetings',
'body'=>'Hi, From PHP Script'
);
$fields=json_encode(array(
'to'=>'topics/all',
'notification'=>$data,
'priority'=>'high'
));
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
$headers = array(
'Content-Type: application/json',
'Authorization:key = '.$api_key
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, ($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
var_dump($result);
curl_close($ch);