Possible Duplicate:
PHP SimpleXML Namespace Problem
I'm writing a PHP script to parse an RSS feed to a webpage. Problem is accessing the date node. I think that PHP is confused because date()
is a PHP function.
<?php
$streamData = simplexml_load_file('http://www.naps.org/index.php/rss/','SimpleXMLElement', LIBXML_NOCDATA);
foreach ($streamData->channel->item as $item){
$itemTitle = ($item->title);
$itemLink = ($item->link);
$itemDate = date_parse($item->date);
$itemYear = $itemDate[year];
$itemMonth = $itemDate[month];
$itemDay = $itemDate[day];
$itemOutputDate = $itemYear.'-'.$itemMonth.'-'.$itemDay;
echo $itemOutputDate;
}
?>
// echos...
--
--
--
--
--
How do I access the $item->date
node?
EDIT
It's actually the <dc:date>
node that I'm trying to access.