Echo Snippet

Code Memo.



CSS 7 ajax 1 backup 1 bash 18 cron 2 darktheme 1 error 1 fichier 1 git 1 htaccess 3 html 17 ip 2 iptables 1 js 2 load 2 markdown 1 nano 2 netatmo 1 php 43 php4 1 php5 2 php7 1 powershell 1 rss 3 stylus 3 youtube 1

.

php7

RSS reader script php7

<?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>';
?>


php php7 rss

https://echosystem.fr/rssall/

<iframe width="100%" height="956" src="https://snippet.echosystem.fr?embed=5949954413d86" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 20/06/2017

Flux RSS de cette page


Echo Snippet 1.84 par Bronco - Page générée en 0.01 s