Skip to content

Instantly share code, notes, and snippets.

@ScottPhillips
Created June 30, 2012 22:43
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 ScottPhillips/3025879 to your computer and use it in GitHub Desktop.
Save ScottPhillips/3025879 to your computer and use it in GitHub Desktop.
Consume an RSS Feed with PHP
<?php
$doc = new DOMDocument();
$doc->load('http://www.softarea51.com/rss/windows/Web_Development/XML_CSS_Utilities.xml');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment