-
-
Save dotcomboom/e467befac034bd2cfa2cfbc3eae769ae to your computer and use it in GitHub Desktop.
dcb.somnol Updates RSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| header("Content-type: text/xml"); | |
| /* ini_set('display_errors', '1'); | |
| ini_set('display_startup_errors', '1'); | |
| error_reporting(E_ALL); */ | |
| echo "<?xml version='1.0' encoding='UTF-8'?> | |
| <rss version='2.0'> | |
| <channel> | |
| <title>Updates - dotcomboom</title> | |
| <link>https://dotcomboom.somnolescent.net/updates</link> | |
| <description>What's new at dotcomboom.somnolescent.net</description> | |
| <language>en-us</language>"; | |
| $dom = new DOMDocument(); | |
| $dom->loadHTMLFile("index.html"); | |
| $articles = $dom->getElementsByTagName('article'); | |
| $dates = $dom->getElementsByTagName('h4'); | |
| /* echo "<debug>" . count($articles) . " articles, " . count($dates) . " dates</debug>"; */ | |
| foreach ($articles as $i => $article) { | |
| $parsed = date_create($dates[$i]->nodeValue); | |
| echo "<item> | |
| <title>" . $dates[$i]->nodeValue . "</title> | |
| <pubDate>" . date('r', date_timestamp_get($parsed)) . "</pubDate> | |
| <link>https://dotcomboom.somnolescent.net/updates/</link> | |
| <description>"; | |
| echo $article->nodeValue; | |
| echo "</description></item>"; | |
| } | |
| echo "</channel></rss>"; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment