I have researched this but have had trouble implementing it into my code. I have:
<?php
$rss = new DOMDocument();
$rss->load('FEEDURL');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
//author
'author' => $node->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/','dc') >item(0)->nodeValue
);
array_push($feed, $item);
}
?>
the section with the comment //author is where I am having problems. The tag in the RSS Feed is <dc:author>
If you have a relevant article that I have missed, please send me there and don’t vote down. Thanks 🙂
dcis namespace,authoris a tag name, so ifhttp://purl.org/dc/elements/1.1/is namespaceURI fordcyou need to search like this:$node->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/','author')