doti3/bar/src/rss.php
2017-12-04 18:17:42 +01:00

30 lines
511 B
PHP
Executable file

#!/usr/bin/php
<?php
require __DIR__.'/base/block.php';
$rss = $argv[1] ?? null;
$title = $argv[2] ?? null;
if (empty($rss) || empty($title)) {
die;
}
$content = @file_get_contents($rss);
if (empty($content)) {
die;
}
preg_match_all('/<entry/isU', $content, $matches, PREG_SET_ORDER);
$fullText = sprintf('[%s] %s', $title, count($matches));
$blockButton = (int) getenv('BLOCK_BUTTON');
if ($blockButton === 1) {
shell_exec('xdg-open https://tiny.deblan.org/index.php');
}
echo $fullText;