{ "success" : false, "chat_room_id" : 0 } { "success" : false, "chat_room_id" : 0 } nama; } else if($type == 2) { $display_name = $sender; } $topic = '/topics/'.$topic; $message = array ( 'type' => $type, 'chat_room_id' => $chat_room_id, 'sender_name' => $display_name, 'sender' => $sender, 'recipient' => $recipient, 'message' => $message, 'message_time' => $datetime ); $url = 'https://fcm.googleapis.com/fcm/send'; $fields = array ( 'to' => $topic, 'data' => $message ); $headers = array ( 'Authorization: key=AAAAMuYa04c:APA91bHwGeJIzLVaVK1TuDygjkkNqeGs6MqzkHcHJE7auUWFo5YdWmjcdw1HmIeZqwJdFopKaiak65zJoiz0ikXJL8o4LyhNWtXqWrxUjav_V6zllgTphA6HgY9NEqXnAWxREtRmOFmc', 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Disabling SSL Certificate support temporarly curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); // Execute post $result = curl_exec($ch); if ($result === FALSE) { die ('Curl failed: '.curl_error($ch)); } // Close connection curl_close($ch); //return $result; ?> { "success" : true, "chat_room_id" : , "message_time" : "" } { "success" : false, "chat_room_id" : 0 }