RSS feed consolidation in PHP

Posted on 2006-03-25
Last Modified: 2008-03-06

I want to do something like the code below (consolidate several RSS feeds on a single page) but that is in ASP and uses XSL. I do NOT want to learn XSL..Nor do I want some RSS to HTML solution based on an external server.

While I don't know much PHP I figured that there should be a class that would just grab a feed and let me iterate over its contents.

Suggestions, recommendations, simple test code?

Question by:Mutley2003

    Author Comment

    oops, forgot the ASP and XSL code
    <!--  ======================================================
                      NEWS CONSOLIDATOR
                      This is originally from
    Sub getXML(sourceFile)
         dim styleFile
         dim source, style
         styleFile = Server.MapPath("news.xsl")

         set source = Server.CreateObject("Msxml2.DomDocument")
         source.async = false
         source.setProperty "ServerHTTPRequest", true
         source.load CStr(sourceFile)

         set style = Server.CreateObject("Msxml2.DomDocument")
         style.async = false
         style.load styleFile

         source.transformNodeToObject style, Response
         set source = nothing
         set style = nothing
    End Sub


    response.write("Hello World!")
    <hr />
    <% getXML("") %>
    <hr />
    <% getXML("") %>
    <hr />
    <% getXML("") %>



    <?xml version="1.0" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="">
    <xsl:output method="xml" encoding="iso-8859-1" omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="*">
    <table border="1" width="600" align="center">
    <tr><td valign="top" align="center" class="title" bgcolor="silver" >
    <xsl:attribute name="href">
    <xsl:value-of select="*[local-name()='channel']/*[local-name()='link']"/>
    <xsl:attribute name="target">
    <xsl:value-of select="*[local-name()='channel']/*[local-name()='title']" disable-output-escaping="yes"/>
    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
    <xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"/>
    </td></tr><tr><td valign="top" bgcolor="ghostwhite" class="headlines" >
    <xsl:for-each select="//*[local-name()='item']">
    <xsl:attribute name="href">
    <xsl:value-of select="*[local-name()='link']"/>
    <xsl:attribute name="target">
    <xsl:value-of select="*[local-name()='title']" disable-output-escaping="yes"/>
    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
    <xsl:value-of select="*[local-name()='description']" disable-output-escaping="yes"/>
    <xsl:template match="/">
    LVL 49

    Accepted Solution

    There are many rssreader classes around.

    Pear has got its XML_RSS class:
    Magpie also has one:

    And there are many more.


    Author Comment

    thanks Roonaan .. that Magpie RssReader looks nice and easy .. just what I want


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now