Пример #1
0
$tv = new SmartTV('192.168.2.103');
// new SmartTV('192.168.2.103', 8080)
/**
 * Set pairing key (if you don't know the pairing key
 *				    execute the method ..->displayPairingKey() and it will
 * 				    be shown on your tv)
 * @param Key
 **/
$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]);
Пример #2
0
**/
if (!isset($_SESSION['SESSION_ID'])) {
    /**
     * Set pairing key (if you don't know the pairing key
     *				    execute the method ..->displayPairingKey() and it will
     * 				    be shown on your tv)
     * @param Key
     **/
    $tv->setPairingKey(678887);
    // $tv->displayPairingKey();
    /**
     * Authenticate to the tv
     * @except Login fails (wrong pairing key?)
     **/
    try {
        $_SESSION['SESSION_ID'] = $tv->authenticate();
    } catch (Exception $e) {
        die('Authentication failed, I am sorry.');
    }
} else {
    $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;