How to implement firebase cloud messaging in server side?
<p>After migrating to Firebase, i tested sending notification by using the firebase console it works fine, but i need a daily notification on a specific time so instead of using the firebase console i use my former cron job to send notification daily. I changed <code>https://android.googleapis.com/gcm/send</code> to <code>https://fcm.googleapis.com/fcm/send</code> but my device doesn't receive any notification. </p>

<p>Is there any way to solve this? Or did I miss anything? my cron job is working fine for my devices that is still using GCM. </p>

<p>Here's my code</p>

<pre><code>function sendNotificationFCM($apiKey, $registrationIDs, $messageText,$id) {


    $headers = array(
            'Content-Type:application/json',
            'Authorization:key=' . $apiKey
    );

    $message = array(
            'registration_ids' =&gt; $registrationIDs,
            'data' =&gt; array(
                    "message" =&gt; $messageText,
                    "id" =&gt; $id,
            ),
    );


    $ch = curl_init();

    curl_setopt_array($ch, array(
            CURLOPT_URL =&gt; 'https://fcm.googleapis.com/fcm/send',
            CURLOPT_HTTPHEADER =&gt; $headers,
            CURLOPT_POST =&gt; true,
            CURLOPT_RETURNTRANSFER =&gt; true,
            CURLOPT_POSTFIELDS =&gt; json_encode($message)
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    return $response;
}
</code></pre>