public function SendPushAndroid($server_key,$token,$title,$message){
$data = json_encode([
"to" => $token,
"notification" => [
"body" => $message,
"title" => $title,
"icon" => "ic_launcher"
]
]);
$url = 'https://fcm.googleapis.com/fcm/send';
$server_key = $server_key;
$headers = array('Content-Type:application/json','Authorization:key='.$server_key);
$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_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
var_dump($result);
if ($result === FALSE) {
die('Oops! FCM Send Error: ' . curl_error($ch));
}
curl_close($ch);
}