README ergänzt, HA-Benachrichtigung optional
This commit is contained in:
22
webhook.php
22
webhook.php
@@ -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