Skip to content

Instantly share code, notes, and snippets.

@styxit
Last active February 5, 2020 11:31
Show Gist options
  • Save styxit/e34d4c6f8cb23d55f5af to your computer and use it in GitHub Desktop.
Save styxit/e34d4c6f8cb23d55f5af to your computer and use it in GitHub Desktop.
A php script that can be used on a Synology Nas to revive Pushover notifications. https://styxit.com/2014/05/10/synology-pushover.html
<?php
/************************************/
/********** CONFING START ***********/
// Only allow request made by localhost?
// Set this to false if this script is not running on your synology webserver (less secure)
$localOnly = true;
/********** CONFING END *************/
/************************************/
echo time();
// Validate httpHost and/or remote addr?
if ($localOnly) {
if ($_SERVER['HTTP_HOST'] != 'localhost') {
// Not locahost
die;
}
}
// Set variables
$options = array(
'message' => isset($_GET['text']) ? $_GET['text'] : false,
'token' => isset($_GET['appkey']) ? $_GET['appkey'] : false,
'user' => isset($_GET['userkey']) ? $_GET['userkey'] : false
);
// Remove empty values
$options = array_filter($options);
// Quit if not exactly 3 get values were found
if (count($options) != 3) {
echo 'invalid options';
die;
}
// Do Pushover curl
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POSTFIELDS => $options
));
curl_exec($ch);
curl_close($ch);
?>
@elRadix
Copy link

elRadix commented Jan 10, 2015

would it possible to have this for pushbullet, would you mind create a second script for pussbullet?

I think only the pushbullet curl command is different, described here:
https://docs.pushbullet.com/v2/pushes/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment