-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsendpush.php
54 lines (43 loc) · 1.63 KB
/
sendpush.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @author Chris Schalenborgh <[email protected]>
* @version 0.1
*/
include "config.inc.php";
include('pushover.php');
$db_handle = mysqli_connect($DBServer, $DBUser, $DBPassword);
$db_found = mysqli_select_db($db_handle, $DBName);
if ($db_found) {
$SQL = "select * from pushover where id = '1' ";
$result = mysqli_query($db_handle, $SQL);
while ($db_field = mysqli_fetch_assoc($result)) {
echo $db_field['setToken'] . "<br>";
echo $db_field['SetUser'] . "<br>";
echo $_GET["Title"] . "<br>";
echo $_GET["Message"] . "<br>";
echo $db_field['SetPriority'] . "<br>";
echo $db_field['SetRetry'] . "<br>";
echo $db_field['SetExpire'] . "<br>";
echo $db_field['SetCallback'] . "<br>";
echo $db_field['SetSound'] . "<br>";
$push = new Pushover();
$push->setToken($db_field['setToken']); //App Token
$push->setUser($db_field['SetUser']); // User Token
$push->setTitle($_GET['Title']);
$push->setMessage($_GET['Message']);
$push->setPriority($db_field['SetPriority']);
$push->setRetry($db_field['SetRetry']); //Used with Priority = 2; Pushover will resend the notification every 60 seconds until the user accepts.
$push->setExpire($db_field['SetExpire']); //Used with Priority = 2; Pushover will resend the notification every 60 seconds for 3600 seconds. After that point, it stops sending notifications.
$push->setCallback($db_field['SetCallback']);
$push->setTimestamp(time());
$push->setDebug(true);
$push->setSound($db_field['SetSound']);
$go = $push->send();
$receipt = $push->getReceipt();
echo '<pre>';
print_r($go);
print "Receipt: $receipt\n";
echo '</pre>';
}
}
?>