49 lines
1.3 KiB
PHP
Executable File
49 lines
1.3 KiB
PHP
Executable File
#!/usr/bin/php
|
|
<?php
|
|
|
|
$abs_path = "gemini://" . getenv("SERVER_NAME") . getenv("SCRIPT_NAME");
|
|
|
|
$READER_LINK = dirname($abs_path) . "/reader";
|
|
# ^^^^^^^ uri path to an instance of reader.php
|
|
# the default is relative, and assumes you have one in the same directory as
|
|
# this script
|
|
|
|
|
|
$abs_path = "gemini://"
|
|
. getenv("SERVER_NAME")
|
|
. getenv("SCRIPT_NAME");
|
|
|
|
$feed_title = "";
|
|
$node_description = "";
|
|
$feed = new XMLReader;
|
|
$feed->open("https://hltv.org/news.rss.php");
|
|
$feed->read();
|
|
|
|
echo "```\n";
|
|
echo " ___ ___ _ _ _ ___ \n";
|
|
echo "| | -_| | | |_ -|\n";
|
|
echo "|_|_|___|_____|___|\n";
|
|
echo "```\n";
|
|
while ($feed->read()) {
|
|
if ( $feed->name === "item") {
|
|
$children = $feed->expand();
|
|
foreach ($children->childNodes as $child) {
|
|
if ( $child->nodeType === XML_TEXT_NODE ) { continue; }
|
|
if ( $child->tagName === "title" ) {
|
|
echo "\n## " . $child->nodeValue . "\n";
|
|
}
|
|
|
|
if ($child->tagName === "description") {
|
|
$story_description = $child->nodeValue;
|
|
}
|
|
|
|
if ($child->tagName === "link") {
|
|
$link = $READER_LINK . "?" . urlencode($child->nodeValue);
|
|
echo "=> " . $link . " " . $story_description . "\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$feed->close();
|