gerkintrigg Posted October 21, 2006 Share Posted October 21, 2006 Hello.I'd like a little help with an RSS feed problem. I have some code to scroll an RSS feed across the top of a site, and know that I want the <item> value from an XML RSS feed to be used in this scroll, but I'm at a loss to how to get this value into a PHP variable.Please help. Link to comment https://forums.phpfreaks.com/topic/24655-rss-reader/ Share on other sites More sharing options...
obsidian Posted October 21, 2006 Share Posted October 21, 2006 i would recommend just getting an rss parser like [url=http://magpierss.sourceforge.net/]Magpie[/url] and using it to help you parse your feed. basically, with that, all you have to do is the following:[code]<?php// require your magpie includerequire_once 'rss_fetch.inc';// define location of your RSS feed$url = 'http://magpie.sf.net/samples/imc.1-0.rdf';// parse the feed$rss = fetch_rss($url);$feedTitle = $rss->channel['title'];// $rss->items holds all your items as an arrayforeach ($rss->items as $item ) { $title = $item[title]; $url = $item[link]; echo "<a href=\"$url\">$title</a><br />\n";}?>[/code]hope that helps Link to comment https://forums.phpfreaks.com/topic/24655-rss-reader/#findComment-112291 Share on other sites More sharing options...
extrovertive Posted October 21, 2006 Share Posted October 21, 2006 Does magpie works for RSS 2.0? Link to comment https://forums.phpfreaks.com/topic/24655-rss-reader/#findComment-112432 Share on other sites More sharing options...
obsidian Posted October 21, 2006 Share Posted October 21, 2006 [quote author=extrovertive link=topic=112236.msg455563#msg455563 date=1161461269]Does magpie works for RSS 2.0?[/quote]somewhat, but not entirely. RSS2.0 is [b]so[/b] much more flexible. from their todo list:[quote]Improve RSS 2.0 support, in all its wacky permutations (as much as I'm annoyed by it)[/quote] Link to comment https://forums.phpfreaks.com/topic/24655-rss-reader/#findComment-112435 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.