Merhaba,Kişiye özel one signal ile push gönderme şansım varmı acaba?
[COLOR=initial]<?php[/COLOR]
//One signal
class oneSignal
{
public $apiKey = 'ddddd'; // Api Key
private $restApiKey = 'aaaaaa'; // Rest Api Key
function __construct()
{
return $this->apiKey;
}
public function sendMessage($messageEn , $url = null)
{
$content = array(
'en' => $messageEn
);
$data = array(
'app_id' => $this->apiKey,
'included_segments' => array('All'),
'contents' => $content,
'url' => $url
);
$data = json_encode($data);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://onesignal.com/api/v1/notifications',
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HEADER => FALSE,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $data,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json; charset=utf-8',
'Authorization: Basic '.$this->restApiKey
),
));
$response = curl_exec($curl);
curl_close($curl);
}
}
$ad = 'nurettin';
$url ='https://www.google.com/';
$oneSignal = new oneSignal();
$oneSignal->sendMessage($ad, $url);
//one signal
?>