Hello, I can’t understand - how to do ‘REST payload’. In my config
switch:
- platform: rest
name: 'Test Rest function'
resource: http://192.168.3.125/HA/rest.php
body_on: '{"status":"true", "action":"status"}'
body_off: '{"status":"false", "action":"status"}'
headers:
Content-Type: application/json
verify_ssl: false
and I try to catch this request by php:
$method = $_SERVER['REQUEST_METHOD'];
$answ['method'] = $method;
//if($method == 'POST'){
$answ['payload'] = $_REQUEST;
if(isset($_POST['action'])) $act = $_POST['action'];
if(isset($_GET['action'])) $act = $_GET['action'];
//echo"Mthod: $method<br>";
$answ['action'] = $act;
$answ['time'] = date("G:i:s");
$answ['ip'] = $_SERVER['REMOTE_ADDR'];
file_put_contents('m_log.log', json_encode($answ));
and have nothing in ‘m_log.log’ file
{"method":"GET","payload":[],"action":null,"time":"15:32:47","ip":"192.168.3.125"}
what’s wrong?