
<?php
   
   include("includes/_admin_bottom.php");
    
  //   $url = "https://fcm.googleapis.com/fcm/send";
  //   $topic = "/topics/toAll";
  //   //replace serverkey with your firebase console project server key
  //   $serverKey = "AAAA6_A3syw:APA91bEOlG3NuAiSya3vh6PyAiSji2KX_Mr0NKelSxHcDEA2eMFDo0P6Ev7DO24ecnhdn9QkEpoT6ukttkEINU1TgaJkC3q0QDJa-VH9AWAzYIQB1xV7b-qbU_4FqcLNtJy1P_FOgmmv";
  //   //$body = '$_POST['body']';
  // //  $intent_filter=$action;
  //   $notification = array('title' =>'title' , 'body' => 'body', 'sound' => 'default', 'badge' => '1');
  //   $arrayToSend = array('to' => $topic, 'notification' => $notification,'priority'=>'high');
  //   $json = json_encode($arrayToSend);
  //   $headers = array();
  //   $headers[] = 'Content-Type: application/json';
  //   $headers[] = 'Authorization: key='. $serverKey;
  //   $ch = curl_init();
  //   curl_setopt($ch, CURLOPT_URL, $url);
  //   curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
  //   curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
  //   curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
  //   //Send the request
  //   $response = curl_exec($ch);
  //   //Close request
  //   if ($response === FALSE) {
  //   die('FCM Send Error: ' . curl_error($ch));
  //   }
  //   curl_close($ch);

?>


  $.ajax({        
            type : 'POST',
            url : "https://fcm.googleapis.com/fcm/send",
            headers : {
                Authorization : 'key=AAAA6_A3syw:APA91bEOlG3NuAiSya3vh6PyAiSji2KX_Mr0NKelSxHcDEA2eMFDo0P6Ev7DO24ecnhdn9QkEpoT6ukttkEINU1TgaJkC3q0QDJa-VH9AWAzYIQB1xV7b-qbU_4FqcLNtJy1P_FOgmmv'
            },
            contentType : 'application/json',
            dataType: 'json',
            data: JSON.stringify({"to": "/topics/toAll", "notification": {"title":"this is title","body":"this is body"},"data":{"STICKERID":'305'}}),
            success : function(response) {
                console.log(response);
            },
            error : function(xhr, status, error) {
                console.log(xhr.error);                   
            }
        });