检索标签为< content:encoded>的RSS feed. [英] Retrieving RSS feed with tag <content:encoded>

查看:166
本文介绍了检索标签为< content:encoded>的RSS feed.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码段:

function getFeed($feed_url) {

$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);

echo "<ul>";

foreach($x->channel->item as $entry) {
    echo "<li><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></li>";
    echo "<li>$entry->content</li>";

echo "</ul>";
}

除了$entry->content

该部分未注册.在实际的供稿中,标记被列为<content:encoded>,但我无法将其供稿.有什么建议吗?

That part doesn't register. In the actual feed the tag is listed as <content:encoded> but I can't get it to feed. Any suggestions?

推荐答案

<content:encoded>中,content命名空间,而encoded是标记名称.

In <content:encoded>, content is the namespace and encoded is the tag name.

您必须使用 SimpleXMLElement::children .查看

You have to use SimpleXMLElement::children. See the output of

var_dump($entry->children("content", true));

这篇关于检索标签为&lt; content:encoded&gt;的RSS feed.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆