0

sorry if this is a noob question,
but i am using the following code to read an RSS feed, and I am wondering how to call the variables (date, title,etc...).

<?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);
	}

?>

how do i display the elements, if i only want to display a certain item in the RSS feed. i am new to PHP and was wondering how to echo the output of the previous code. this might sound confusing but i just want to know how to use the results of the code.. Thanks

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by pritaeas
0
foreach ($arrFeeds as $idx => $item) {
  echo $idx . ' ' . $item['title'] . ' ' . $item['date'] . '<br/>';
}

This will loop the items, show the index, name and date

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.