-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathindex.php
More file actions
30 lines (26 loc) · 850 Bytes
/
index.php
File metadata and controls
30 lines (26 loc) · 850 Bytes
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
<?php
// Receive HTTP POST request body
$json_string = file_get_contents('php://input');
/* now $json_string should contain JSON array like this:
[
{
'channel.id': 94,
'ident': '1234',
'peer': '127.0.0.1:53862',
'protocol.id': 19,
'server.timestamp': 1554447820.251666,
'timestamp': 1554447820.251666
}
]
*/
// more details about available message content:
// https://flespi.com/kb/messages-basic-information-units
// just store it in a file
// please note that it will be overwritten on each new request
$file_handle = fopen('messages.json', 'w');
fwrite($file_handle, $json_string); // Write received messages to file
fclose($file_handle);
// NOTE: it's important to send HTTP 200 OK status
// to acknowledge successful messages delivering
http_response_code(200);
?>