Clone the repo
git clone https://github.com/mafuth/onesignal-sdk.git
config
require 'onsignal.class.php';
$ONESIGNAL = new onesignal (
'your app id',
'your app key',
'your app icon',
'your app safari web id',
'your app email'
);
send a notification
$ONESIGNAL -> creatNotification(
'user ids to get notification',
'title of the notification',
'your message',
'redirect url'
);
cancel a notification
$ONESIGNAL -> cancelNotification('notification id');
get notification history
print_r($ONESIGNAL -> getHistory());
get all user devices
print_r($ONESIGNAL -> getDevices());
creat html code to get user id and post to a url using ajax jquery
echo $ONESIGNAL -> createCode(
'url you want to sent a post request with user id',
'post variable for user id',
'if you have ajax.js already included in you scripts use true else use false'
);