以下是我在php中从wordpress feed url获取Feed的代码:
$weburl='http://kaleidicopub.wpengine.com/category/kaleidico/feed/';
$rss = new DOMDocument();
$rss->load($weburl);
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'content' => $node->getElementsByTagName('encoded')->item(0)->nodeValue,
'author' => $node->getElementsByTagName('creator')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'category' => $node->getElementsByTagName('category')->item(0)->nodeValue,
'tag' => $node->getElementsByTagName('tag')->item(0)->nodeValue,
);
array_push($feed, $item);
}
如何从中获取帖子标签?我可以获得类别但无法获得帖子标签。请帮帮我。