-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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