Example

Example – Example for the usage of XML_RSS

Usage example

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

Fetching headlines from Slashdot

<?php
require_once "XML/RSS.php";

$rss =& new XML_RSS("http://rss.slashdot.org/Slashdot/slashdot");
$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";
?>
Requirements for running XML_RSS (Previous) Constructor (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.