Domanda

Ho un feed RSS di un blog che sto cercando di visualizzare su un altro sito web usando Magpie RSS Parser.Recupera correttamente i tag "link" e "titolo", ma non recupera il contenuto del post del blog.In passato, l'ho ottenuto per funzionare, ma il contenuto era racchiuso in un tag.In questo caso, il contenuto appare come tale:

XML :

<content type="html">Test post&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/886334333339671757-1360251841923051040?l=grippofunkband.blogspot.com' alt='' /&gt;&lt;/div&gt;</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;                        
}
.

Qualcuno può pensare perché non prendesse ciò che è nel tag del contenuto, o se c'è un modo in cui posso lavorare attorno a questo problema?Qualsiasi aiuto sarebbe molto apprezzato!

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top