this question is rather trivial, but despite searching and trying out different approaches I cannot get it work.
I have the following content in my action.php
<?php
function sendCommand($item, $data)
{
$url = "https://host/rest/items/" . $item;
$options = array(
'http' => array(
'header' => "Content-type: text/plain\r\n",
'method' => 'POST',
'content' => $data //http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
?>
This is part of my html page
<form action="action.php?item=CancelParty&data=ON" method="post" align="center" class="form-inline" role="form">
<button type="submit" class="btn btn-warning btn-fill">Volume down</button>
</form>
But my request is not being processed. What am I missing? I usually don't do any php or REST calls, for a webdeveloper this one must be really easy I think :)