RSS_PHP RSS Parser Examples

The examples below are using RSS_PHP Free (v1) - the new more powerful RSS_PHP version 3 adds even more functionality.

These examples are listed here purely to show the capabilities of RSS_PHP, they are to be used for reference only; does not promote the use of these scripts in a production environment.

Digg Front Page RSS to XHTML using RSS_PHP

This simple little script will use the RSS_PHP RSS Parser to retrieve digg's front page RSS and display as XHTML.

require_once 'rss_php.php';    

    $rss = new rss_php;
    $items $rss->getItems();

    $html '';
    foreach($items as $index => $item) {
        $html .= '<p><a href="'.$item['link'].'" title="'.$item['title'].'"><strong>'.$item['title'].'</strong></a><br />
.$item['description'].'<br />
                    Submitted by: <a href="'
.$item['digg:submitter']['digg:userimage'].'">'.$item['digg:submitter']['digg:username'].'</a> :: '.$item['pubDate'].'<br />
                    Diggs: '
.$item['digg:diggCount'].' :: <em>Category: '.$item['digg:category'].'</em>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digg Front Page</title>

echo $html;

Google News RSS to JSON for use with AJAX

Here's a simple RSS_PHP solution to convert Google News RSS to JSON using RSS_PHP:

require_once 'rss_php.php';    

    $rss = new rss_php;

    echo json_encode($rss->getRSS());

Other possible uses of RSS_PHP

RSS_PHP has can be used to parse any form of RSS, from any accessible source. Other Integrations may involve

  • GeoRSS > JSON > AJAX > Google Maps API
  • Yahoo Web Search API in RSS
  • Torrent RSS

Or perhaps a combine some of the following RSS resources..

For more information view the RSS_PHP RSS Parser Introduction or go straight to the full RSS_PHP documentation; and to get started download the latest version of RSS_PHP for use in your PHP applications for free.

Valid XHTML 1.0 Strict

return to the top of the page