With this code i can send notifications and show correct body text. But anybody know how can i put a target url for this code?
<?php
define('API_ACCESS_KEY', 'xxxx');
$registrationIds = 'xxxx';
$msg = array(
'body' => 'test',
'title' => 'Title Of Notification',
'sound' => 'default'
);
$fields = array(
'to' => $registrationIds,
'notification' => $msg,
'priority' => 'high'
);
$headers = array(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
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));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>