Feedburner original item link using SimplePie

I have faced a problem with the rss aggregator script in the way of grabbing feedburner.com blogs rss content with the feedburner original item link.

because the grabbed link was something like : http://feedproxy.google.com/~r/PlusCSS/~3/yje-06jXa-s/ not the feedburner original item link and this type of links makes problems as not redirecting properly especially in mobile view.
so after searching here and there I got a useful way to get the feedburner original item link.

adding ?format=xml to the end of feedburner.com rss link to become http://feeds.feedburner.com/PlusCSS?format=xml
then in the grab code I added this :

$feed = new SimplePie();
$array = array_reverse($feed->get_items(0,10));
foreach ($array AS $item) {
$link = $item->get_permalink();
// the condition here
if (strpos($link,'feedproxy') != false) { // if the link contains (feedproxy) then the link is from feedburner.com
$orig = $item->get_item_tags('http://rssnamespace.org/feedburner/ext/1.0','origLink');
$permalink = $orig[0] ['data'] 

} else {
$permalink = $link;
// the rest of code

That’s the best way to parse feedburner.com feeds with simplepie class.

Leave a Comment

Your email address will not be published. Required fields are marked *