-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebhook.php
64 lines (41 loc) · 1.06 KB
/
webhook.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
55
56
57
58
59
60
61
62
63
64
<html>
<body>
<?php
/*
$rawData = file_get_contents("php://input");
syslog(LOG_DEBUG, 'rawData: ' .$rawData);
$url = 'core.php';
$data = $rawData;
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => $data,
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
*/
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$webhookUrl = $_POST['webhookUrl'];
if (empty($webhookUrl)) {
echo "webhookUrl is empty";
exit();
}
$webhookUrl = rawurlencode($webhookUrl);
include 'include.php';
$URL = $apiURL. 'setWebhook?url='.$webhookUrl.'';
//syslog(LOG_INFO, 'setWebhook_URL: ' .$URL);
$antwort = file_get_contents($URL);
syslog(LOG_DEBUG, 'antwort setWebhook: ' .$antwort);
echo 'antwort setWebhook: ' .$antwort;
} else {
echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'">
webhookUrl: <input type="text" name="webhookUrl">
<input type="submit">
</form>';
}
?>
</body>
</html>