'Hi, '.$additional_data['to_whom'] .' - PD was '. $additional_data['pd_status'], 'body'=> $msg, 'icon' => 'https://pdgenie.com/logo/sinelogo.png', 'img' => 'https://pdgenie.com/logo/sinelogo.png' ); self::dispatchNotification(array($web_token),$web_msg,1,$additional_data); } public static function notifyMob($mob_token,$msg,$additional_data) { $app_msg = array ( 'message'=> $msg, 'body'=> $msg, //'title'=> $msg, 'subtitle'=> $msg, 'tickerText'=> $msg, 'vibrate'=>1, 'sound'=>1, 'largeIcon'=>'https://pdgenie.com/logo/sinelogo.png', 'smallIcon'=>'https://pdgenie.com/logo/sinelogo.png' ); self::dispatchNotification(array($mob_token),$app_msg,2,$additional_data); } public static function dispatchNotification($token,$msg,$type,$additional_data) { $fields = array ('registration_ids'=>$token, //'data'=>$app_msg, 'notification' => $msg ); $headers = array ('Authorization: key=' . FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY, '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, true ); curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields )); $result = curl_exec($ch ); curl_close( $ch ); $CI =&get_instance(); MYLOG::logFunction(null,(isset($additional_data['pd_id'])?$additional_data['pd_id']:""))->info("PUSH NOTIFICATION ",array('firebase_result' => $result,'additional_data' => $additional_data,'token_type' => ($type == 1? 'WEB' : 'MOB'),'token' => $token)); } } ?>