File "send_notification.php"
Full Path: /home/analogde/www/filechange/WEBSITE/douche/send_notification.php
File size: 1.07 KB
MIME-type: text/x-php
Charset: utf-8
<?php
function sendGCM($message, $id)
{
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array (
'registration_ids' => array (
$id
),
'data' => array (
"message" => $message
)
);
$fields = json_encode ( $fields );
$headers = array (
'Authorization: key=' . " AIzaSyBcLZC09KOOWmFpA3HGSlVtnTjTUgo6pbU",
'Content-Type: application/json'
);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_POST, true );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields );
$result = curl_exec ( $ch );
echo $result;
curl_close ( $ch );
}
$id = "AAAAQBIQvvQ:APA91bHvar2dumjaeZD_yKx6cHzRhSKPlsad7BIAaK_75PeuphtmvO-V4svGcpsyVzLENF1igDkWL645XyKR0EFZshLgcgKKPtf4EsBwyKM8SURyNVxN39grMehnpEWJl_6n5Ii62c9HWkVBK0CHsBYpoMUWDVtbng";
$message = "gloup";
$id = "";
sendGCM($message, $id);
?>