Код: Выделить всё
$url='http://IP:8080/jsonrpc?request={
"description": "Shuts the system running Kodi down",
"params": [],
"permission": "ControlPower",
"returns": {
"type": "string"
},
"type": "method"
})';
getURL($url,0);
Модератор: immortal
Код: Выделить всё
$url='http://IP:8080/jsonrpc?request={
"description": "Shuts the system running Kodi down",
"params": [],
"permission": "ControlPower",
"returns": {
"type": "string"
},
"type": "method"
})';
getURL($url,0);
нет вы же используете - гетурл .... а вам надо пост урл...Denis_k писал(а): ↑Вт июн 30, 2020 6:04 pmpost запрос для выключения должен выглядеть как то так?Код: Выделить всё
$url='http://IP:8080/jsonrpc?request={ "description": "Shuts the system running Kodi down", "params": [], "permission": "ControlPower", "returns": { "type": "string" }, "type": "method" })'; getURL($url,0);
Код: Выделить всё
$url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc';
$data = array('jsonrpc' => '2.0',
'id' => '1',
'method' => 'Player.PlayPause',
'params' => array('playerid' => 0));
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, FALSE, $context);
if ($result === FALSE) { /* Handle error */ };