Skip to content

Instantly share code, notes, and snippets.

@ressof
Forked from styxit/synology-pushover.php
Created February 5, 2020 11:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ressof/96c094411b903308ed3c23e3973301f9 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