#RSS reader script php7 #https://echosystem.fr/rssall/ <?php // script reader RSS flux .php 2017 php7 $cache_time = 3600*24; // 24 hours $cache_file = $_SERVER['DOCUMENT_ROOT'].'/cache/test.rss'; $timedif = @(time() - filemtime($cache_file)); if (file_exists($cache_file) && $timedif < $cache_time) { $string = file_get_contents($cache_file); } else { $string = file_get_contents('https://echosystem.fr/rssall/'); //https://rss.echosystem.fr/i/?a=rss&get=c_6 if ($f = @fopen($cache_file, 'w')) { fwrite ($f, $string, strlen($string)); fclose($f); } } $xml = simplexml_load_string($string); // place the code below somewhere in your html echo ' <div id="rssbox"> <ul>'; $count = 0; $max = 6; // the next object is an example for a feed from wordpress foreach ($xml->channel->item as $val) { if ($count < $max) { echo ' <li> <strong>'.$val->title.'</strong><br /> '.$val->description.' | <a href="'.$val->link.'">More ></a> </li>'; } $count++; } echo ' </ul> </div>'; ?>