Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#16 Aggregate items from multiple RSS feeds

open
nobody
None
5
2008-06-13
2008-06-13
Jamie McClelland
No

Attached is a patch to rss_utils.inc that provides two new functions to help people aggregate items from more than one feed.

// Pull in from two feeds
$url1 = ;
$urls2 = 'http://rss2.feed';

// Fetch both feeds
$rss1 = fetch_Rss('http://rss1.feed');
$rss2 = fetch_Rss('http://rss2.feed');

// Merge the items of both feeds
$merged_items = merge_items($rss1->items,$rss2->items);

$rss1->items = $merged_items;

etc...

Discussion

  •  
    Attachments
  •  
    Attachments
  • Logged In: YES
    user_id=140302
    Originator: YES

    Woops - corrected path using krsort instead of rsort.
    File Added: rss_utils.inc.patch

     
  • Logged In: NO

    $tab_url = array('http://yourfeed','http://yourfeed2');

    foreach($tab_url as $url)
    {
    $rss = fetch_rss($url);
    $f = $rss->channel['title'];
    $g = $rss->image['url'];
    foreach ($rss->items as $item )
    {
    $a = $item[title];
    $b = $item[link];
    $c = $item[pubdate];
    $d = $item[description];
    ...