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

foreach ($arrFeeds as $idx => $item) {
  echo $idx . ' ' . $item['title'] . ' ' . $item['date'] . '<br/>';
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.