Results 1 to 2 of 2

Thread: Trouble combining multiple RSS feeds into one feed

  1. #1
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Trouble combining multiple RSS feeds into one feed

    The problem I keep running into is that the final output does not validate. The three feeds are valid individually but not when a use my script:
    Code:
    <?php
    
    $handle1 = fopen("rss_news.xml", "r");
    $contents = stream_get_contents($handle1);
    fclose($handle1);
    echo $contents;
    
    $handle2 = fopen("rss_articles.xml", "r");
    $contents1 = stream_get_contents($handle2);
    echo $contents1;
    fclose($handle2);
    
    $handle3 = fopen("rss_creativeart.xml", "r");
    $contents2 = stream_get_contents($handle3);
    echo $contents2;
    fclose($handle3);
    
    ?>
    And since it is not valid Feedburner will not accept it. http://validator.w3.org/feed/check.c....net%2Frss.php
    Last edited by Spinethetic; 06-04-2008 at 03:42 PM. Reason: typo

  2. #2
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    What I think is happening is that when all feeds are combined, the final output still retains all opening and closing <rss> and <channel> tags. So how would I go about omitting these tags dynamically so that my php would look something like
    Code:
    <?php
    echo "<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'>";
    echo "<channel>";
    
    $handle1 = fopen("rss_news.xml", "r");
    $contents = stream_get_contents($handle1);
    echo $contents;
    fclose($handle1);
    
    $handle2 = fopen("rss_articles.xml", "r");
    $contents1 = stream_get_contents($handle2);
    echo $contents1;
    fclose($handle2);
    
    $handle3 = fopen("rss_creativeart.xml", "r");
    $contents2 = stream_get_contents($handle3);
    echo $contents2;
    fclose($handle3);
    
    echo "</channel>";
    echo "</rss>";
    ?>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •