ExpressionEngine® 3 User Guide

Legacy Documentation

You are using the documentation for version 3.5.17. Go here for the latest version or check here for your available upgrades to the latest version.

RSS Parser Class

The RSS Parser Class is singularly used as a factory to create SimplePie objects.

create($url[, $duration = 180[, $cache_name = '']])

Creates a SimplePie object given a url, and optionally a cache duration and name:

ee()->load->library('rss_parser');
$feed = ee()->rss_parser->create(
    'https://ellislab.com/blog/rss-feed',
    30, // 30 minute cache
    'blog_feed'
);

// Perform operations on SimplePie object...
$offset = 0;
$limit = 5;
foreach ($feed->get_items($offset, $limit) as $index => $item)
{
  $title = $item->get_title();
  $content = $item->get_content();
  ...
Parameters:
  • $url (string) – URL of the RSS feed to parse
  • $duration (int) – (optional) Length of the cache in minutes
  • $cache_name (string) – (optional) Name of feed for namespacing in the cache
Returns:

SimplePie object

Return type:

Object

Note

If the $url of the feed cannot be found an Exception is thrown.