Add super-simple-rssreader.php
This commit is contained in:
commit
310bba287e
1 file changed
+27
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
// URL til RSS-feeden
|
||||||
|
$rss_url = "https://news.google.com/rss/search?q=taubane%20OR%20totausbane%20OR%20kabelbane%20OR%20gondol%20when%3A30d&hl=no&gl=NO&ceid=NO%3Ano";
|
||||||
|
|
||||||
|
// Hent RSS-feeden
|
||||||
|
$rss = simplexml_load_file($rss_url);
|
||||||
|
|
||||||
|
// Sjekk om RSS-feeden ble lastet inn
|
||||||
|
if ($rss) {
|
||||||
|
//echo "<h1>" . $rss->channel->title . "</h1>";
|
||||||
|
echo "<div class=\"rss-feed\">\n";
|
||||||
|
echo " <h3 class=\"rss-title\">Tau- og kabelbanenytt</h3><ul>\n";
|
||||||
|
foreach ($rss->channel->item as $item) {
|
||||||
|
$source = $item->source;
|
||||||
|
$title = substr($item->title, 0, -3 - strlen($source));
|
||||||
|
//$description = strip_tags($item->description);
|
||||||
|
echo " <li>";
|
||||||
|
//echo "<p>" . $source . "</p>";
|
||||||
|
echo "<a href=\"" . $item->link . "\" target=\"_blank\">" . $title . "</a> <span> | " . $source . "</span>";
|
||||||
|
//echo "<p>" . $description . "</p>";
|
||||||
|
echo "</li>\n";
|
||||||
|
}
|
||||||
|
echo " </ul>\n</div>\n";
|
||||||
|
} else {
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in new issue
Block a user