Ejemplo n.º 1
0
//$url = 'http://mosforge.net/export/rss_sfnews.php';
//*******************CODE*************************
//instantiate rss document
$cacheDir = './';
$cacheTime = 3600;
$rssdoc = new xml_domit_rss_document_lite($url, $cacheDir, $cacheTime);
//get total number of channels
$totalChannels = $rssdoc->getChannelCount();
//loop through each channel
for ($i = 0; $i < $totalChannels; $i++) {
    //get reference to current channel
    $currChannel = $rssdoc->getChannel($i);
    //echo channel info
    echo "<h2><a href=\"" . $currChannel->getLink() . "\" target=\"_child\">" . $currChannel->getTitle() . "</a>";
    echo "  " . $currChannel->getDescription() . "</h2>\n\n";
    //get total number of items
    $totalItems = $currChannel->getItemCount();
    //loop through each item
    for ($j = 0; $j < $totalItems; $j++) {
        //get reference to current item
        $currItem = $currChannel->getItem($j);
        //echo item info
        echo "<p><a href=\"" . $currItem->getLink() . "\" target=\"_child\">" . $currItem->getTitle() . "</a> " . $currItem->getDescription() . "</p>\n\n";
    }
}
echo $rssdoc->toNormalizedString(true);
?>

</body>
</html>