我已經研究過這個,但在實現它到我的代碼時遇到了麻煩。我有:使用php解析rss feed中的不尋常標籤。 (有標籤<dc:author>)
<?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);
}
?>
該部分的評論//author
是我有問題的地方。 RSS Feed中的標籤是<dc:author>
如果您有一篇我錯過的相關文章,請發送給我,不要投票。謝謝:)
我知道這是不是問題,但如果你想爲了能夠閱讀幾乎所有的RSS/Atom feed,你應該看看[SimplePie](http://simplepie.org/)庫。 – Nicolas