Ok. Mir lässt sowas dann keine Ruhe
Probier dann morgen das Beispiel hier aus. Damit sollte auch Benutzer/Passwort funktionieren.
PHP
<?php
function GetURLAsString($input)
{
if (function_exists('curl_version'))
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $input);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($curl);
curl_close($curl);
}
else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen'))
{
$content = file_get_contents($input);
}
else
{
echo 'No cURL or allow_url_fopen';
die;
}
return $content;
}
$kodi_ip = "192.168.1.70";
$kodi_port = "8080";
$kodi_user = "kodi";
$kodi_pass = "kodi";
$json = 'http://'.$kodi_user.':'.$kodi_pass.'@'.$kodi_ip.':'.$kodi_port.'/jsonrpc?request={"jsonrpc":"2.0","method":"Player.GetItem","params":{"properties":["title","fanart","thumbnail"],"playerid":1},"id":0}';
$json_response = GetURLAsString($json);
$data = json_decode($json_response,true);
$kodi_title = $data["result"]["item"]["label"];
$kodi_thumb = $data["result"]["item"]["thumbnail"];
$kodi_fanart = $data["result"]["item"]["fanart"];
echo $json."<br>";
echo $json_response."<br>";
echo print_r($data)."<br>";
echo $kodi_title."<br>";
echo $kodi_thumb."<br>";
echo $kodi_fanart."<br>";
$pixsource_thumb = 'http://'.$kodi_user.':'.$kodi_pass.'@'.$kodi_ip.':'.$kodi_port.'/image/'.urlencode($kodi_thumb);
$pixsource_fanart = 'http://'.$kodi_user.':'.$kodi_pass.'@'.$kodi_ip.':'.$kodi_port.'/image/'.urlencode($kodi_fanart);
echo "<br>";
echo('<img src="'.$pixsource_thumb.'" alt="Kodi thumb">');
echo "<br>";
echo('<img src="'.$pixsource_fanart.'" alt="Kodi fanart">');
?>
Alles anzeigen