27 lines
725 B
PHP
27 lines
725 B
PHP
<?php
|
|
$url = 'http://localhost/identia/api_notifications.php';
|
|
$data = array(
|
|
'action' => 'create_notification',
|
|
'icon' => 'mdi-battery-charging-100',
|
|
'title' => 'Test API Push',
|
|
'message' => 'Ini adalah tes push notifikasi melalui API.',
|
|
'detail' => 'Tes pengiriman via cURL',
|
|
'is_danger' => 0
|
|
);
|
|
|
|
$options = array(
|
|
'http' => array(
|
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
|
'method' => 'POST',
|
|
'content' => http_build_query($data)
|
|
)
|
|
);
|
|
$context = stream_context_create($options);
|
|
$result = file_get_contents($url, false, $context);
|
|
|
|
if ($result === FALSE) {
|
|
echo "Error processing request";
|
|
} else {
|
|
echo "Response: " . $result;
|
|
}
|