This component allows you to read (external) RSS feeds and use their data in your own application.
For example, if you would like to show the latest news of a site that is of interest to your audience,
you can use this component to fetch the latest articles of their feed to publish in your app.
- Implement the component into your controller by using:
- Call the component in your controller, to fetch the items from an RSS feed. For example if you want to set the $news array, containing the contents.
public $components = array(‘Rss’);
public function beforeRender() {
try {
$newsItems = $this->Rss->read('http://example.com/feed');
} catch(InternalErrorException $e) {
$newsItems = null;
}
$this->set('news', $newsItems);
}