Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

DwApiRss

pritaeas edited this page Apr 25, 2013 · 22 revisions

Class to get (filtered) RSS feeds.

Restrictions set by DaniWeb: the feed is cached, it will not contain over 100 articles, and articles will be no older than 90 days.

Exceptions

Read more about common exceptions.

Public class methods

GetFeed

Returns the RSS feed, optionally filtered by forum ID and/or RSS article type.

Parameters

$forumId      int     Forum ID (optional).
$articleType  string  RSS article type (optional).

Exceptions

DwApiException  EX_INVALID_INT               Invalid forum ID.
DwApiException  EX_INVALID_TYPE_RSS_ARTICLE  Invalid RSS article type.

Return value

string  RSS feed.

See also

DwApiBase->GetRssArticleTypes

Code example

include 'DwApiRss.class.php';
$dwApi = new DwApiRss();
try
{
    $siteFeed = $dwApi->GetFeed();                  // site feed
    $phpFeed = $dwApi->GetFeed(17);                 // PHP forum feed
    $siteNewsFeed = $dwApi->GetFeed(null, 'news');  // news articles feed
    $phpCodeFeed = $dwApi->GetFeed(17, 'code');     // PHP forum code snippets feed
}
catch (DwApiException $exception)
{
    die($exception->getMessage());
}