Skip to content

Instantly share code, notes, and snippets.

@underdown
Last active December 20, 2015 23:29
Show Gist options
  • Select an option

  • Save underdown/6213359 to your computer and use it in GitHub Desktop.

Select an option

Save underdown/6213359 to your computer and use it in GitHub Desktop.
rss feed reader
<?php
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo "<ul>";
$counter = 0;
foreach($x->channel->item as $entry) {
while($counter < 3){
echo "<li><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></li>";
break;
}
$counter++;
}
echo "</ul>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment