PEAR Manual
Prev |  | Next

# Example

Example -- Example for the usage of XML_RSS

## Usage example

The following script fetches the latest headlines from Slashdot.org via RSS.

Example 59-1. Fetching headlines from Slashdot
    require_once "XML/RSS.php";

    $rss =& new XML_RSS("http://slashdot.org/slashdot.rdf");
    $rss->parse();

    echo "<h1>Headlines from <a href=\"http://slashdot.org\">Slashdot</a></h1>\n";
    echo "<ul>\n";

    foreach ($rss->getItems() as $item) {
        echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n";
    }

    echo "</ul>\n";

Prev | Home | Next
Requirements | Up | XML_RSS::XML_RSS