PHP code example of Simplepie
1. Go to this page and download the library: Download simplepie/simplepie library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Simplepie example snippets
$simplePie = new SimplePie();
$simplePie->set_cache_location('mycache');
$simplePie->set_feed_url("https://packagist.org/feeds/releases.rss");
$simplePie->init();
echo $simplePie->get_title();
echo "
";
echo $simplePie->get_description();
echo "
";
echo $simplePie->get_link();
echo "
";
echo $simplePie->get_item_quantity();
echo "
";
//Specify the start and end of the items. Can be used for paging.
foreach ($simplePie->get_items(0, 5) as $item) {
echo "----------------------------------------";
echo "
";
echo $item->get_title();
echo "
";
echo $item->get_description();
echo "
";
echo $item->get_link();
echo "
";
foreach ($item->get_authors() as $author) {
echo $author->get_name();
}
echo "
";
}