Php 使用FCM推送通知

Php 使用FCM推送通知,php,Php,我使用FCM向IOS应用程序发送推送通知,IOS开发人员向我提供设备令牌和服务器密钥,我在谷歌上搜索并尝试了不同的解决方案,但没有任何效果,所以请让我知道我的代码有什么问题,并获取错误信息{ “多播_id”:8569689262516537799, “成功”:0, "失败":一,, “规范的_id”:0, “结果”:[ { “错误”:“无效注册” } ] } 提前感谢 $ch = curl_init("https://fcm.googleapis.com/fcm/send");

我使用FCM向IOS应用程序发送推送通知,IOS开发人员向我提供设备令牌和服务器密钥,我在谷歌上搜索并尝试了不同的解决方案,但没有任何效果,所以请让我知道我的代码有什么问题,并获取错误信息{ “多播_id”:8569689262516537799, “成功”:0, "失败":一,, “规范的_id”:0, “结果”:[ { “错误”:“无效注册” } ] } 提前感谢

    $ch = curl_init("https://fcm.googleapis.com/fcm/send");

    //The device token.
    $token = "c2420d68a0838d8fb6b26ef06278e899de73a149e93c9fe13df11f70f3dd5cc1"; //token here
    //Title of the Notification.
    $title = "Carbon";

    //Body of the Notification.
    $body = "Bear island knows no king but the king in the north, whose name is stark.";

    //Creating the notification array.
    $notification = array('title' => $title, 'text' => $body);

    //This array contains, the token and the notification. The 'to' attribute stores the token.
    $arrayToSend = array('to' => $token, 'notification' => $notification, 'priority' => 'high');

    //Generating JSON encoded string form the above array.
    $json = json_encode($arrayToSend);
    //print_r($json); die();
    //Setup headers:
    $headers = array();
    $headers[] = 'Content-Type: application/json';
    $headers[] = 'Authorization: key=AAAAx6P1Nz0:APA91bEqkVCA9YRw9gpUvmF8UOVrYJ5T8672wfS_I7UAT3dA0g1QS7z-Z4fpn8JMiJ5kFRz9ZGc2K64hKZG-4__PAUqm733hqNDuFCDv9'; // key here
    //Setup curl, add headers and post parameters.
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);


    //Send the request
    $response = curl_exec($ch);

    //Close request
    print_r($response);
    curl_close($ch);

    //return $response;

您发送的令牌号很可能是错误的。尝试“/topics/all”这将向所有注册的用户发送通知