Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- require_once('token.php');
- $fcmEndpoint = "https://fcm.googleapis.com/v1/projects/?/messages:send";
- $headers = [
- 'Authorization: Bearer ' . $jwtToken,
- 'Content-Type: application/json',
- ];
- $data = [
- 'message' => [
- 'token' => '?',
- 'notification' => [
- 'title' => 'Titel der Benachrichtigung',
- 'body' => 'Inhalt der Benachrichtigung',
- ],
- ],
- ];
- $ch = curl_init($fcmEndpoint);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
- $response = curl_exec($ch);
- curl_close($ch);
- echo $response;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement