array( $token ), "data" => array("message" => $message)); $fields = json_encode($fields); $headers = array( 'Authorization: key=' . "108102546370", 'Content-Type: application/json' ) $post = [ "message" => array("notification" => array( "title" => "FCM Message", "body" => "This is an FCM Message") "token" => $token ) ]; $curl = curl_init() curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURL_POSTFIELDS, $fields); $response = curl_exec($curl); var_dump($response); curl_close($curl); /* curl -X POST -H "Authorization: Bearer ya29.ElqKBGN2Ri_Uz...HnS_uNreA" -H "Content-Type: application/json" -d '{ "message":{ "notification":{ "title":"FCM Message", "body":"This is an FCM Message" }, "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..." }}' https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send */