Magpie RSS 不显示内容
我有一个博客的 RSS 提要,我正在尝试使用 Magpie RSS 解析器将其显示在另一个网站上。它可以正确获取“链接”和“标题”标签,但不会获取博客帖子的内容。过去,我已经让它工作了,但内容被包含在标签中。在这种情况下,内容显示如下:
XML:
<content type="html">Test post<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/886334333339671757-1360251841923051040?l=grippofunkband.blogspot.com' alt='' /></div></content>
PHP
require_once 'rss/rss_fetch.inc';
$url = 'http://feeds.feedburner.com/grippofunkband?format=xml';
//http://grippofunkband.blogspot.com/feeds/posts/default';
$rss = fetch_rss($url);
$i = 0;
$max = 4;
foreach ($rss->items as $item ) {
$title = $item['title'];
$content = $item['content'];
$url = $item['link'];
$pubDate = $item['updated'];
echo "<li>$title<br />$url<br />$content</li>";//<a href='$url'></a>
if (++$i == $max) break;
}
谁能想到为什么它不抓取内容标签中的内容,或者是否有一种方法可以工作围绕这个问题?任何帮助将不胜感激!
I have a blog's RSS feed that I am trying to display on another website using Magpie RSS parser. It is correctly fetching the 'link' and 'title' tags, but will not fetch the content of the blog's post. In the past, I have gotten it to work, but the content was enclosed in a tag. In this case, the content appears as such:
XML:
<content type="html">Test post<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/886334333339671757-1360251841923051040?l=grippofunkband.blogspot.com' alt='' /></div></content>
PHP
require_once 'rss/rss_fetch.inc';
$url = 'http://feeds.feedburner.com/grippofunkband?format=xml';
//http://grippofunkband.blogspot.com/feeds/posts/default';
$rss = fetch_rss($url);
$i = 0;
$max = 4;
foreach ($rss->items as $item ) {
$title = $item['title'];
$content = $item['content'];
$url = $item['link'];
$pubDate = $item['updated'];
echo "<li>$title<br />$url<br />$content</li>";//<a href='$url'></a>
if (++$i == $max) break;
}
Can anyone think of why it's not grabbing what's in the contents tag, or if there is a way I can work around this issue? Any help would be much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是 RSS 提要。这是一个 Atom 提要,我认为这可能是您的基本问题。根据记忆,尝试抓取
atom_content
而不是content
,但这可能取决于您使用的 Magpie 的确切版本。That's not an RSS feed. It's an Atom feed, which I think is probably your basic problem. From memory, try grabbing
atom_content
instead ofcontent
, but it may depend on the exact version of Magpie you're using.