<?php

function sentNotif($fcmId,$message,$healthTipId){
    $msg = array(
        'to'=>$fcmId,
        'notification' => array('body'=>"Skedwise Staff",'title'=>'Schedule',
        'click_action'=>'','sound'=>'tone'),
        'data' => array(
            'type'=>"Health Tips",
            'title'=>'Salons',
            "message"=>$message,
            "ht_id"=>$healthTipId));
    $headers = array(
            'Authorization: key=AAAARZOnnvk:APA91bFS43lli-5xA-RBgNYxYaJmsn8wU5Z02QKzQgsjh71KGcwnsf7YOrdGKsNPA5mJWvCllP5sF6u1jQcAwc9K6UGM009XBv-JvyN4DHnMyl9owsk2BP-p3PcCzKyalbCc-t26JZ_v',
            '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( $msg ) );
    $result = curl_exec($ch );
    curl_close( $ch );
    $resp = json_decode($result);
    if($resp->success == 1){
        return true;
    }else{
        return false;
    }
}