Created
December 4, 2014 01:29
-
-
Save cwlsn/7f498413de5c9129181d to your computer and use it in GitHub Desktop.
Grab an RSS feed and parse it into an unordered list with PHP.
This file contains 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 | |
function RSSFeedAsList($feedUrl) { | |
$content = file_get_contents($feedUrl); | |
$items = new SimpleXmlElement($content); | |
echo "<ul>"; | |
foreach($items->channel->item as $entry) { | |
echo "<li><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></li>"; | |
} | |
echo "</ul>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment