I am using [
pushover.net...] to send notifications to a smartphone from our website.
This works fine when using php i.e.:
<?php
//pushover notification
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POSTFIELDS => array(
"token" => "XXX",
"user" => "XXX",
"sound" => "cashregister",
"message" => "Test Message",
),
CURLOPT_SAFE_UPLOAD => true,
//Set to false for testing
CURLOPT_RETURNTRANSFER => true,
));
curl_exec($ch);
curl_close($ch);
}
?>
I now need to send a notification that contains some browser info so I need to send this client side. Is there a way to send this via ajax? The user and token keys would need to remain private so I am assuming the ajax would need to access a php script? I am not too familiar with ajax so don't know how to do this.
Pushover API info can be found here:
[
pushover.net...]