We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


RSS feed consolidation in PHP

Mutley2003 asked
Medium Priority
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?

Watch Question


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("http://radio.weblogs.com/0106235/rss.xml") %>
<hr />
<% getXML("http://radio.weblogs.com/0106735/rss.xml") %>
<hr />
<% getXML("http://radio.weblogs.com/0106985/rss.xml") %>



<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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="/">
Top Expert 2006
There are many rssreader classes around.

Pear has got its XML_RSS class: http://pear.php.net/package/XML_RSS
Magpie also has one: http://magpierss.sourceforge.net/

And there are many more.


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


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

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.