-function playVideoOnDreambox($videoUrl, $dreamboxHost)
-{
- ini_set('track_errors', 1);
- $xml = file_get_contents('http://' . $dreamboxHost . '/web/session');
- if ($xml === false) {
- errorOut('Failed to fetch dreambox session token: ' . $php_errormsg);
- }
- $sx = simplexml_load_string($xml);
- $token = (string) $sx;
-
- $playUrl = 'http://' . $dreamboxHost
- . '/web/mediaplayerplay'
- . '?file=4097:0:1:0:0:0:0:0:0:0:'
- . str_replace('%3A', '%253A', rawurlencode($videoUrl));
-
- $ctx = stream_context_create(
- array(
- 'http' => array(
- 'method' => 'POST',
- 'header' => 'Content-type: application/x-www-form-urlencoded',
- 'content' => 'sessionid=' . $token,
- //'ignore_errors' => true
- )
- )
- );
- $ret = file_get_contents($playUrl, false, $ctx);
- if ($ret !== false) {
- header('HTTP/1.0 200 OK');
- echo "Video play request sent to dreambox\n";
- exit(0);
- } else {
- errorOut(
- 'Failed to send video play request to dreambox: ' . $php_errormsg
- );
- }
-}