5

I want to grab the RSS feed content from a site and display it in my website with different filtering options.

Can anyone put a php script which can grab the content from there and show

Kara
  • 6,115
  • 16
  • 50
  • 57
Rahul TS
  • 1,208
  • 7
  • 26
  • 53
  • possible duplicate of [Best way to parse RSS/Atom feeds with PHP](http://stackoverflow.com/questions/250679/best-way-to-parse-rss-atom-feeds-with-php) and [some others](http://stackoverflow.com/search?q=parse+rss+feed+php "Searches StackOverflow for Parse RSS Feed"). Consider using an RSS parser or DOM. Also, please increase your Accept Rate. – Gordon Oct 18 '10 at 10:47

2 Answers2

4

SO is for asking specific questions related to programming. Even though your question is related to programming you are not asking a specific question.

A quick google search for "PHP read RSS feeds gives you a list of very good links which can get you started.

How to Read an RSS Feed With PHP – screencast

Try out the example and see if it fits your requirement. If you have any specific questions then come back to SO and I am sure everyone will be glad to help.

Shoban
  • 22,920
  • 8
  • 63
  • 107
1

something like this:

rss.php

<?php

    // enable php_xsl extension

    $xml = new DomDocument;
    $xml->load("http://www.gamestv.org/rss.php?type=news&limit=8");

    $xsl = new DomDocument;
    $xsl->load("RSSFeed.xsl");

    $xp = new XsltProcessor();
    $xp->importStylesheet($xsl);
    if($html = $xp->transformToXML($xml)) echo $html;
?>

RSSFeed.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/rss/channel">
    <xsl:for-each select="/rss/channel/item">
        <div style="padding-bottom:10px; padding-top:10px;"><a>
            <xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute>
            <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
            <xsl:value-of select="title"/>
        </a></div>
        <div><xsl:value-of disable-output-escaping="yes" select="description"/></div>
    </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
Jon Black
  • 16,223
  • 5
  • 43
  • 42