RSS Reader в PHP

How to show an RSS feed with a simple PHP function. File URL
- locally, as: rs.xml, or
- deleted as: https://www.iqlevsha.ru/rss.xml.

There is only one difference if the filename has the extension. "php," when it is generated by the CMS or other software, locally the file is treated as a text file by the server, and remotely treated as a script. It makes no difference whether the extension is. "xml."

The script is compatible with:
- RSS 2.0.
- RSS RDF or RSS 1.0.
In fact, the script extracts the title, link, and description tags and ignores the document structure format.
The advantage of using PHP to display an RSS feed is that it will be visible to search engines.

RSS 2.0 File Structure

An RSS stream consists of a feed and one or more items corresponding to articles. Everyone has a name, URL and description. Read more in the specification referenced below.

<rss version="2.0">
  <channel>
    <title> RSS</title>
    <link>https://www.iqlevsha.ru/rss/</link>
    <description>
      Tools et documents pour RSS.
    </description>
    <item>
      <title>Le lecteur RSS</title>
      <link>https://www.iqlevsha.ru/rss/lecteur-rssphp</link>
      <description>
        Fonction pour afficher un flux RSS.
      </description>
    </item>
  </channel>
</rss>

API functions

The interface consists of two functions:

RSS_Display()

To view a complete stream with a feed, headers, related articles, and their descriptions.

RSS_Links()

To view only a list of titles associated with items.

Source code

The source contains other internal functions:

RSS_Retrieve(url)     // extraie le channel et appelle RSS_Channel.
RSS_Channel(channel)  // extraie les données du channel et appelle RSS_Tags.
RSS_RetrieveLink(url) // appelle RSS_Tags pour chaque item d'un channel.
RSS_Tags(item)        // extraie title, links, description pour un article.

See the rsslib.php script.

Show date

Version 2010 adds an argument to add date mapping.

RSS_Display(url, nombre, true, true);

If the last parameter is missing, the date is not displayed .

Show link on site or not

Version 2009 allows you to view the name and description of the site. This is the third RSS_Display parameter.

By default, it is not displayed. To show it, use this syntax:

RSS_Display(url, nombre, true);

Otherwise, call:

RSS_Display(url, nombre);  

or:

RSS_Display(url);

the default number of articles is 15.

Demo

Demos are templates that can be learned and used on your own site, according to the terms of the Mozilla license. You can use the form to enter the URL of the stream. You can delete a form and replace it with the URL of a specific thread. The RSS feed can appear on the same or a different page.

Versions

The amendments take into account questions in French/English forums.

Loading

The archive contains a script and a demo.

Documentation

License: Mozilla 1.1. Screenplay by Denis Suro.

Discussion board

RSS drive in PHP 4

21-01-2008 12:09:54

Dev

Hi, the RSS player featured on this site (https://www.iqlevsha.ru/rss/lecteur-rss.php) works very well, but is only compatible with PHP5. I tried unsuccessfully to adapt it to PHP 4. I'm a little nervous. Will anyone have a compatible version under their elbow? Dev
21-01-2008 13:31:50

webmaster

It uses the PHP 5 XML library. With PHP 4, you can use the same methods as for Sidepress https://www.iqlevsha.ru/wordpress/sidepress.php.