FIREBASE_TOPIC . $publish['topic'], 'data' => $notification); $url = 'https://fcm.googleapis.com/fcm/send'; $headers = array('Authorization: key=' . FIREBASE_API, 'Content-Type: application/json'); $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_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); $output = curl_exec($ch); if (!json_decode($output)) { print_r($output); die; } curl_close($ch); return json_decode($output); } }