Skip to content

Instantly share code, notes, and snippets.

@cwlsn
Created December 4, 2014 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwlsn/7f498413de5c9129181d to your computer and use it in GitHub Desktop.
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.
<?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