//Code to catch the accessToken????
$url = 'https://fcm.googleapis.com/v1/projects/my_project_id/messages:send';
$data = array
(
'data_text' => 'You cant always get what you want',
'data_sender' => 'Sir Mick',
'data_senddate' => 'Sept. 21th, 2024',
);
$message = (
'message' => (
'topic' => $'greatExpectations',
'data' => $data,
'android' => ('priority' => 'high'),
),
);
$headers = array
(
'Authorization: Bearer ' . $accessToken,
'Content-Type: application/json'
);
$ch = curl_init(); // Open connection
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $message ) );
$result = curl_exec($ch); // Execute post
curl_close($ch); // Close connection