Skip to content

Instantly share code, notes, and snippets.

@lavir
Forked from styxit/synology-pushover.php
Created September 22, 2016 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lavir/0b723c6e608350d4501ac124cd8bf640 to your computer and use it in GitHub Desktop.
Save lavir/0b723c6e608350d4501ac124cd8bf640 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);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment