Magpie RSS not displaying content
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['conte开发者_开发技巧nt'];
$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!
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.
精彩评论