**/ $tv->setPairingKey(678887); // $tv->displayPairingKey(); /** * Authenticate to the tv * @except Login fails (wrong pairing key?) **/ try { $tv->authenticate(); } catch (Exception $e) { die('Authentication failed, I am sorry.'); } /** * Set your volume up. **/ $tv->processCommand(TV_CMD_VOLUME_UP); /** * Set your volume down **/ $tv->processCommand(TV_CMD_VOLUME_DOWN); /** * Move your mouse **/ $tv->processCommand(TV_CMD_MOUSE_MOVE, ['x' => 20, 'y' => 20]); /** * Trigger a mouse click **/ $tv->processCommand(TV_CMD_MOUSE_CLICK); /** * Get current volume **/
$tv->setSession($_SESSION['SESSION_ID']); } if (isset($_GET['cmd'])) { switch ($_GET['cmd']) { case 'screen': header('Content-Type: image/jpeg'); exit($tv->queryData(TV_INFO_SCREEN)); break; case 'changeChannel': if (!isset($_GET['value'])) { exit; } $channelName = strtolower($_GET['value']); foreach ($_SESSION['CHANNEL_LIST'] as $channel) { if (strtolower($channel['chname']) == $channelName) { $tv->processCommand(TV_CMD_CHANGE_CHANNEL, $channel); break; } } break; case 'info': $currentChannel = $tv->queryData(TV_INFO_CURRENT_CHANNEL); $text = 'You\'re watching <b>' . $currentChannel->progName . '</b> on <b>' . $currentChannel->chname . '</b>'; if (!isset($_SESSION['CURRENT_CHANNEL']) || strtolower($currentChannel->chname) != strtolower($_SESSION['CURRENT_CHANNEL'])) { $text .= '___---___Change channel: <select id="programList">'; if (!isset($_SESSION['CHANNEL_LIST'])) { $_SESSION['CHANNEL_LIST'] = array(); foreach ($tv->queryData(TV_INFO_CHANNEL_LIST) as $channel) { $_SESSION['CHANNEL_LIST'][] = (array) $channel; } }