I am trying to parse an RSS file using the following PHP:
$doc = new DOMDocument();
$doc->load($address);
$feedArr = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
foreach($node->getElementsByTagName('category') as $catNode) {
$itemRSS['category'][] = $catNode->nodeValue;
}
}
It works fine except if the category node has a domain attribute. When it does, it seems to completely ignore it the category.
Any ideas why?