File "firebase_test.php"
Full Path: /home/analogde/www/filechange/WEBSITE/douche/firebase_test.php
File size: 1.46 KB
MIME-type: text/x-php
Charset: utf-8
<?php
// projetFirebaseMessaging
$path_to_firebase_cm = 'https://fcm.googleapis.com/fcm/send';
$token = "
ddj6bzohfkk:APA91bE7DjknBJC10tmiXDJz-Lyhc-Hl1XHFeU9MhcGd8OvQq6S8FDXeAlrCMX2ZRtwm4HLGiilXvJ0kn3VKYUOxFh2gGPWxHnuOWHyMySL2F6hq0pGXFiSsyJR64gdiJ9xchDyzNOB3w8wj0decTr7P52txLIHBsQ";
$fields = array(
'to' => $token,
'notification' => array('title' => 'Working Good', 'body' => 'That is all we want'),
'data' => array('message' => $message)
);
// ancien clé serveur
$api_KEY = "AIzaSyD2d6W9_b3M5ES6c-kpRKOZd4sa6LNZu5g";
// nouvelle clé serveur
$api_KEY ="AAAA-53wG4I:APA91bGyXIRJl0X-AoWeU57KseVze8aiB1rooMerHZmd83vmwX7Q7kFh9-Ugq2S3h_1X_gubzQZjb28YUzgFLRqeQmkJ7_9gukwUnla6_vugNBrp-PHOtx3fHNKrGgUIJ3GFBwBY9EVt7P5rbt5ZS0RJI9qJfpLBHA";
$headers = array(
'Authorization:key=' . $api_KEY,
'Content-Type:application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $path_to_firebase_cm);
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_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
echo "done";
?>