RSSService (since version 2.0)
Type Service
Methods
Description
This service is used to genarete or simply import RSS feeds.
Imported RSS feeds can be modified and displayed or saved to disk.
The RSS service supports the RSS version 2.0 and has an simple interface to interact with imported feeds or to create an RSS feed to keep your readers up to date.
Imported RSS feeds can be modified and displayed or saved to disk.
The RSS service supports the RSS version 2.0 and has an simple interface to interact with imported feeds or to create an RSS feed to keep your readers up to date.
Examples
<?php
// set the RSS version as example, default 2.0
RssService::SetFeedVersion('2.0');
// set the encoding type (iso-8859-1, UTF-8, etc...), default UTF-8
RssService::SetFeedContentType('iso-8859-1');
// create channel, has to be created before adding an item
$Channel = RssService::CreateChannel();
$Channel->title = 'My RSS Feed';
$Channel->description = 'RSS Feed created with BrickOO';
$Channel->pubDate = date(DATE_RSS);
// create new item
$Item = RssService::CreateItem();
$Item->title = 'First item';
$Item->description = 'First item description';
$Item->pubDate = date(DATE_RSS);
// create new item
$Item = RssService::CreateItem();
$Item->title = 'Second item';
$Item->description = 'Second item description';
$Item->pubDate = date(DATE_RSS);
// create new item
$Item = RssService::CreateItem();
$Item->title = 'Third item';
$Item->description = 'Third item description';
$Item->pubDate = date(DATE_RSS);
// flush the current RSS feed to the client
RssService::Flush();
?>
// set the RSS version as example, default 2.0
RssService::SetFeedVersion('2.0');
// set the encoding type (iso-8859-1, UTF-8, etc...), default UTF-8
RssService::SetFeedContentType('iso-8859-1');
// create channel, has to be created before adding an item
$Channel = RssService::CreateChannel();
$Channel->title = 'My RSS Feed';
$Channel->description = 'RSS Feed created with BrickOO';
$Channel->pubDate = date(DATE_RSS);
// create new item
$Item = RssService::CreateItem();
$Item->title = 'First item';
$Item->description = 'First item description';
$Item->pubDate = date(DATE_RSS);
// create new item
$Item = RssService::CreateItem();
$Item->title = 'Second item';
$Item->description = 'Second item description';
$Item->pubDate = date(DATE_RSS);
// create new item
$Item = RssService::CreateItem();
$Item->title = 'Third item';
$Item->description = 'Third item description';
$Item->pubDate = date(DATE_RSS);
// flush the current RSS feed to the client
RssService::Flush();
?>
<?php
// load RSS Feed from web location
RssService::Load('http://news.google.com/?output=rss');
// retrieve the current Feed XML as string
$feedOutput = RssService::Generate();
// save the imported feed to the filesystem
FilesystemService::SaveFile('current_rss_news.xml', $feedOutput);
?>
// load RSS Feed from web location
RssService::Load('http://news.google.com/?output=rss');
// retrieve the current Feed XML as string
$feedOutput = RssService::Generate();
// save the imported feed to the filesystem
FilesystemService::SaveFile('current_rss_news.xml', $feedOutput);
?>
Last change 10/18/2009