PHP code example of dg / rss-php

1. Go to this page and download the library: Download dg/rss-php 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/ */

    

dg / rss-php example snippets


$rss = Feed::loadRss($url);

echo 'Title: ', $rss->title;
echo 'Description: ', $rss->description;
echo 'Link: ', $rss->url;

foreach ($rss->item as $item) {
	echo 'Title: ', $item->title;
	echo 'Link: ', $item->url;
	echo 'Timestamp: ', $item->timestamp;
	echo 'Description ', $item->description;
	echo 'HTML encoded content: ', $item->{'content:encoded'};
}

$atom = Feed::loadAtom($url);

Feed::$cacheDir = __DIR__ . '/tmp';
Feed::$cacheExpire = '5 hours';

Feed::$userAgent = "FeedFetcher-Google; (+http://www.google.com/feedfetcher.html)";

composer