题
我有一个博客的RSS Feed,我正在尝试使用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;
}
有人可以想到为什么它没有抓取内容标签中的内容,或者如果有一种方法可以解决这个问题?任何帮助都会受到欣赏!
解决方案
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 of content
, but it may depend on the exact version of Magpie you're using.