PHP Classes

RSS Feed Reader: Parse and display items of an RSS feed

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (10)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 5,906 All time: 391 This week: 164Up
Version License PHP version Categories
rss_feed_reader 2.2GNU General Publi...5HTML, XML
Description 

Author

Simple class for parsing RSS feeds.

Returns feed as array so you can do what you wish with results.

It supports SimpleXML parsing, the old XML parser and even text parser, based on regexps.

There is also support for multiple ways to read the feed (cURL, file_get_contents and fopen). It also supports category tags.

Picture of Daniel Tlach
Name: Daniel Tlach <contact>
Classes: 2 packages by
Country: Czech Republic Czech Republic
Age: 39
All time rank: 4075 in Czech Republic Czech Republic
Week rank: 371 Up4 in Czech Republic Czech Republic Up

Recommendations

Extract last modified date of a website from RSS feed
I want to get the last modified date of a website

Example

<?php

header
( 'Content-Type: text/html; charset=utf-8' );

error_reporting(E_ALL);
ini_set('display_errors', true);

include
'./Rss.minified.php'; // include library

$Rss = new Rss; // create object

/*
    XML way
*/
try {
   
$feed = $Rss->getFeed('http://blog.danaketh.com/rss/items', Rss::XML);
    echo
'<pre>';
    foreach(
$feed as $item) {
        echo
"<b>Title:</b> <a href=\"$item[link]\">$item[title]</a>\n";
        echo
"<b>Published:</b> $item[date]\n";
        echo
"<b>Category:</b> $item[category]\n";
        echo
"\n$item[description]\n";
        echo
"<hr/>";
    }
    echo
'</pre>';
}
catch (
Exception $e) {
    echo
$e->getMessage();
}

/*
    SimpleXML way
*/
try {
   
$feed = $Rss->getFeed('http://blog.danaketh.com/rss/items', Rss::SXML);
    echo
'<pre>';
    foreach(
$feed as $item) {
        echo
"<b>Title:</b> <a href=\"$item[link]\">$item[title]</a>\n";
        echo
"<b>Published:</b> $item[date]\n";
        echo
"<b>Category:</b> $item[category]\n";
        echo
"\n$item[description]\n";
        echo
"<hr/>";
    }
    echo
'</pre>';
}
catch (
Exception $e) {
    echo
$e->getMessage();
}

/*
    Text way
*/
try {
   
$feed = $Rss->getFeed('http://blog.danaketh.com/rss/items', Rss::TXT);
    echo
'<pre>';
    foreach(
$feed as $item) {
        echo
"<b>Title:</b> <a href=\"$item[link]\">$item[title]</a>\n";
        echo
"<b>Published:</b> $item[date]\n";
        echo
"<b>Category:</b> $item[category]\n";
        echo
"\n$item[description]\n";
        echo
"<hr/>";
    }
    echo
'</pre>';
}
catch (
Exception $e) {
    echo
$e->getMessage();
}


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example usage
Accessible without login Plain text file licence.txt Lic. Licence
Plain text file Rss.minified.php Class Minified version of the class
Plain text file Rss.php Class Class source file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:5,906
This week:0
All time:391
This week:164Up
User Ratings User Comments (3)
 All time
Utility:86%StarStarStarStarStar
Consistency:85%StarStarStarStarStar
Documentation:-
Examples:90%StarStarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1108
 
Very good class, but i've need a change, in place to use file...
13 years ago (jorge)
57%StarStarStar
very good!
14 years ago (raphael souza)
70%StarStarStarStar
Very good and simple one.
14 years ago (Thales Jacobi)
60%StarStarStarStar