我在向Firebase项目中的主题发送推送通知时遇到问题。如果我运行PHP脚本,我给了我错误' invalidRegistration'
php脚本:
DELETE FROM t_old a
using t_prop b
where a.company_id IS NOT DISTINCT FROM b.company_id
and b.company_id is null;
我的应用程序中 FCM实例ID 服务的代码;
<?php
$topic = "/topics/info";
$fcm_server_url = "https://fcm.googleapis.com/fcm/send";
$title = utf8_encode("AleXoTroN");
$content_text = utf8_encode("AleXoTroN");
$color_code = utf8_encode("#2baa7f");
$httpheader = array('Content_Type:application/json', 'Authorization:key=***');
$msg = array('to' => $topic, 'data' => array('title' => $title, 'content_text' => $content_text, 'color' => $color_code));
$curl_connection = curl_init();
curl_setopt($curl_connection, CURLOPT_URL, $fcm_server_url);
curl_setopt($curl_connection, CURLOPT_POST, true);
curl_setopt($curl_connection, CURLOPT_HTTPHEADER, $httpheader);
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $msg);
$answerFromServer = curl_exec($curl_connection);
curl_close($curl_connection);
echo "Server:<br/>".$answerFromServer;
?>