README ergänzt, HA-Benachrichtigung optional
This commit is contained in:
1 parent
fdc2eb6c07
commit
d48080da27
3 files changed
+75
-11
No files matched your search
+12
-10
@@ -42,16 +42,18 @@ switch ($data['event']) {
|
||||
function send_notification($msg, $url = null) {
|
||||
global $hawebhook;
|
||||
|
||||
$post = [ 'message' => $msg ];
|
||||
if ($url != null) $post['url'] = $url;
|
||||
|
||||
$ch = curl_init($hawebhook);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post));
|
||||
$rc = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if ($hawebhook != "") {
|
||||
$post = [ 'message' => $msg ];
|
||||
if ($url != null) $post['url'] = $url;
|
||||
|
||||
$ch = curl_init($hawebhook);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post));
|
||||
$rc = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
}
|
||||
|
||||
function test_finished() {
|
||||
|
||||
Reference in new issue
Block a user