<?php
class Validate_firebase_token extends CI_Controller {
function index() {
//this code is useful for validation of token active or not
$firebase_push_notification_token = "FIREBASE_SERVER_APP_KEY";
$headers = array
(
'Authorization: key=' . $firebase_push_notification_token,
'Content-Type: application/json'
);
$data_for_android = [
'registration_ids' => [
"user_push_device_id_1",
"user_push_device_id_2",
"user_push_device_id_3"
],
"dry_run" => TRUE
];
$data_string = json_encode($data_for_android);
$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_POSTFIELDS, $data_string);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
}
}
- multicast_id: -1,
- success: 1,
- failure: 2,
- canonical_ids: 0,
- results: [
- {
- message_id: "fake_message_id"
- {
- error: "InvalidRegistration"
- {
- error: "MismatchSenderId"
0 comments:
Post a Comment