<META NAME="robots" CONTENT="noindex,nofollow">


<?php
	if(isset($_POST['activity']))
    {
      $msg = $_POST['msg'];
      $title = $_POST['title'];
      $activity = $_POST['activity'];
      $path_to_fcm = "https://fcm.googleapis.com/fcm/send";
      $server_key = "AAAA2X1gkUs:APA91bGZ9N3kvzfIOqe-CdGUybnkq9mwFJOsGQbTnR7hvULtvnNG9Ab1kddvsGNUxYpJLzMCZ_2wFAzsVXovj8jUwVQyEyBp6XngG2DIhR4VlxpOISDM4Qj1JCMnB_61HQ9xdYlQOcNy";

      $curl_session = curl_init();

      $headers = array(
              'Authorization: key=' . $server_key,
              'Content-Type: application/json'
          );

      if($activity == "NONE")
      {
          $fields = array(
              'to' => '/topics/IPO',
              'notification'=> array(
                  'title'=> $title,
                  'body'=> $msg
              ));
      }
      else
      {
          $fields = array(
              'to' => '/topics/IPO',
              'notification'=> array(
                  'title'=> $title,
                  'body'=> $msg,
                  'click_action' => $activity
              ));
      }
      $payload = json_encode($fields);


       curl_setopt($curl_session, CURLOPT_URL,$path_to_fcm);
       curl_setopt($curl_session, CURLOPT_POST, true);
       curl_setopt($curl_session, CURLOPT_HTTPHEADER, $headers);
       curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, false);
       curl_setopt($curl_session, CURLOPT_POSTFIELDS, $payload);

       $res = curl_exec($curl_session);

      curl_close($curl_session);
