Ejemplo n.º 1
0
<?php

/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.download', 'PHP API Example (Download)', '1.0.0');
$App->authorize();
$App->openSession();
/// Download configuration
$DownloadConfigService = new \alphayax\freebox\api\v3\services\download\Configuration($App);
$DlConfig = $DownloadConfigService->getConfiguration();
print_r($DlConfig);
$DlConfig = $DownloadConfigService->updateThrottlingMode('normal');
print_r($DlConfig);
Ejemplo n.º 2
0
<?php

/// Require Composer AutoLoader
require_once '../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.permission', 'PHP API Example (permission)', '1.0.0');
$App->authorize();
$App->openSession();
$hasExplorerPermission = $App->hasPermission(\alphayax\freebox\api\v3\symbols\Permissions::EXPLORER);
var_dump($hasExplorerPermission);
Ejemplo n.º 3
0
<?php

/// Require Composer AutoLoader
require_once '../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.version', 'Freebox PHP API Example (Version)', '1.0.0');
$App->setFreeboxApiHost('https://xxx.freeboxos.fr:17105');
$App->setAppToken('xxxxxxxxxxxxxxxxxxxx');
$VersionService = new \alphayax\freebox\api\v3\services\ApiVersion($App);
$version = $VersionService->getApiVersion();
print_r($version);
Ejemplo n.º 4
0
<?php

/// Require Composer AutoLoader
require_once '../../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.dl_rss', 'Alphayax RSS Downloader', '1.0.0');
$App->authorize();
$App->openSession();
/// Scan files for configs
$config_rfi_s = glob('config/*.json');
foreach ($config_rfi_s as $config_rfi) {
    $config = json_decode(file_get_contents($config_rfi), true);
    $config = checkRSS($config, $App);
    file_put_contents($config_rfi, json_encode($config, JSON_PRETTY_PRINT));
}
/**
 * @param $config
 * @param $App
 * @return array
 */
function checkRSS($config, $App)
{
    echo "Scan RSS {$config['rss']} for pattern {$config['pattern']}" . PHP_EOL;
    $rss = simplexml_load_file($config['rss']);
    foreach ($rss->xpath('//item') as $item) {
        $title = (string) $item->xpath('title')[0];
        $date = (string) $item->xpath('pubDate')[0];
        $link = (string) $item->xpath('link')[0];
        $desc = (string) $item->xpath('description')[0];
        if (preg_match($config['pattern'], $title)) {
            if (strtotime($date) > $config['last_date']) {
Ejemplo n.º 5
0
<?php

/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.os', 'AYX Freebox OS', '1.0.0');
/// Begin association (go to the Freebox Player led display)
echo "Begin association" . PHP_EOL;
$App->authorize();
$App->openSession();
echo "Generated app_token : " . $App->getAppToken() . PHP_EOL;