You are here:  » Multiple RSS feeds

Support Forum



Multiple RSS feeds

Submitted by aslater on Mon, 2009-05-18 15:31 in

Hello

Is it possible to use multiple RSS feeds on the same page using Magic Parser?

Thanks

Submitted by support on Mon, 2009-05-18 15:48

Hi,

Absolutely - but the page load time has to be considered of course - the parsing is quick, but the HTTP requests that your server will make as a result of each request take time and all add up.

If all the feeds you want to incorporate are of the same RSS format then a single record handler function would suffice, but there is no reason why you can't use different record handler functions per feed if you need to handle them differently.

If they can all be handled with the same function; in addition to your other page generation code you would be looking at something as straight forward as this;

  function myRecordHandler($record)
  {
    print "<h4><a href='".$record["LINK"]."'>".$record["TITLE"]."</a></h4>";
    print "<p>".$record["DESCRIPTION"]."</p>";
  }
  MagicParser_parse("http://www.example.com/rss.xml","myRecordHandler","xml|RSS/CHANNEL/ITEM/");
  MagicParser_parse("http://www.example.net/rss.xml","myRecordHandler","xml|RSS/CHANNEL/ITEM/");
  MagicParser_parse("http://www.example.org/rss.xml","myRecordHandler","xml|RSS/CHANNEL/ITEM/");

Hope this helps!
Cheers,
David.

Submitted by aslater on Mon, 2009-05-18 18:40

Great thanks for your help.