<?php



//   $msg=[
// 		"NotificationType" => "Message",
//                     "title" => "New Message",
//                     "profile_picture"=>"",
// 					"id"=>"$id",
// 					"room_id"=>"",
// 					"user_id"=>"$memberid",
// 					"user_name"=>'',
// 					"content"=>"$message",
// 					"timestamp"=>"$createdate",
// 					"type"=>"$messagetype"
//                     ];

// $token="cB0zOhNpTCC9p9T7P4TneY:APA91bHN4CvV6hgbIMPS9wtrDULsztK5OEW-08AxYgGBs_lQFH6SxJdRZYDm6nN05xBH8CMofKrDJOZ9luZPCOU2zznBeefujuHPKKhDrVp5PiahJy_poB3PAk9CIJBMs5kOSA0VQYVX";
// SendMessage($token,$msg);

function SendMessage($token,$msg)
{

echo "Rahul";
if (!defined('API_ACCESS_KEY')) define('API_ACCESS_KEY', 'AIzaSyDkTaH_RMRQWiChsrpBWGirc8hzdpM7bU4');
	
$fields = array
(
    'to'=>$token,
    'data'=>$msg


);
$headers = array
(
    'Authorization: key=' ."AAAAwyE_kKE:APA91bGKtFD32Ev-O_2l5ytb0bD-ml8Qj7jPwKKr0KsltF_dNzlh38ltJe4Q_VkrcHj0fVhXg3P3SphSbDJteK7iccla2gCMNvuwim_skmZTYdQFoKhzX1EMZfNL9bXN6LgpZdpFLxxu",
    'Content-Type: application/json'
);

$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_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
 echo $result = curl_exec($ch );
 echo curl_error($ch);
curl_close( $ch );

 return $result;
}
?>