Echo Snippet

Kick 'n'Dirty



CSS 8 DNS 1 SQL 1 ajax 1 apache 3 bash 11 convert 3 crontab 2 css 1 error 1 fail2ban 2 gogs 1 grav 1 htaccess 3 html 13 ip 8 iptables 2 js 6 mail 2 nano 2 netatmo 1 php 42 php4 1 php5 2 php7 1 plex 1 powershell 1 regex 1 rss 3 secu 1 shell 25 ssl 2 stylus 3 tls 1 windows 1 youtube 2

.

rss

[PHP] 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 07/09/2021

RSS XML Movie

<?

/*
    PHP RSS Dir
    Aalaap Ghag
    http://www.aalaap.com
    aalaap@gmail.com
    2007

    This script, when run from a directory containing files, will provide an
    RSS 2.0 feed that contains the list and modification times for all the
    files.

    If you have a folder on your server with files that you want to share, you
    can use this script to provide an RSS feed to your users instead of a plain
    simple directory listing. Being an RSS feed with modification times, it
    also allows users to be notified of new items as and when you put them.

    The script is based on a simple directory listing script I found on the
    web. It had no owner info, so I don't know who to credit.

    This is just the first release of the script. I will be adding new features to it.

    This script is provided under the MIT license.

*/

// Change this according to your folder and content. 
// TODO: Automatic fallback defaults
$feedName = "Index of /movies";
$feedDesc = "This is a list of all the movies available for download in this folder.";
$feedURL = "http://localhost/movies";
$feedBaseURL = "http://localhost/movies/"; // must end in trailing forward slash (/).

$allowed_ext = ".MPG,.AVI,.RMVB,.MOV";

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla' ) {
    $header = 'Content-Type: text/xml;'
} else {
    $header = 'Content-Type: application/rss+xml;'
}

header($header . ' charset=UTF-8;')

?><<?= '?'; ?>xml version="1.0"<?= '?'; ?> encoding="utf-8">
<rss version="2.0">
    <channel>
        <title><?=$feedName?></title>
        <link><?=$feedURL?></link>
        <description><?=$feedDesc?></description>
<?
$files = array();
$dir=opendir("./");

while(($file = readdir($dir)) !== false)  
{  
    $path_info = pathinfo($file);
    $ext = strtoupper($path_info['extension']);

    if($file !== '.' && $file !== '..' && !is_dir($file) && strpos($allowed_ext, $ext)>0)  
    {  
        $files[]['name'] = $file;  
        $files[]['timestamp'] = filemtime($file);  
    }  
}  
closedir($dir);
// natcasesort($files); - we will use dates and times to sort the list.

for($i=0; $i<count($files); $i++) {
    if($files[$i] != "index.php") {
        // echo "<li><a href=\"".$files[$i]."\">"  . substr($files[$i], 0, strrpos($files[$i], ".")) . "</a></li>\n";
        echo "    <item>\n";
        echo "        <title>". $files[$i]['name'] ."</title>\n";
        echo "        <link>". $feedBaseURL . $files[$i]['name'] . "</link>\n";
        echo "        <pubDate>". date("D M j G:i:s T Y", $files[$i]['timestamp']) ."</pubDate>\n";
        echo '        <guid isPermalink="true">'. $feedBaseURL . $files[$i]['name'] . '</guid>\n';
        echo "    </item>\n";
    }
}
?>
    </channel>
</rss>

php rss

<iframe width="100%" height="1676" src="https://snippet.echosystem.fr?embed=553eb56523924" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 28/04/2015

RSS check dir

 
<?php
 
function listing($repertoire){
 
    $fichier = array();
 
    if (is_dir($repertoire)){
 
        $dir = opendir($repertoire);                              //ouvre le repertoire courant désigné par la variable
        while(false!==($file = readdir($dir))){                             //on lit tout et on récupere tout les fichiers dans $file
 
            if(!in_array($file, array('.','..'))){            //on eleve le parent et le courant '. et ..'
 
                $page = $file;                            //sort l'extension du fichier
                $page = explode('.', $page);
                $nb = count($page);
                $nom_fichier = $page[0];
                for ($i = 1; $i < $nb-1; $i++){
                    $nom_fichier .= '.'.$page[$i];
                }
                if(isset($page[1])){
                    $ext_fichier = $page[$nb-1];
                    if(!is_file($file)) { $file = '/'.$file; }
                }
                else {
                    if(!is_file($file)) { $file = '/'.$file; }            //on rajoute un "/" devant les dossier pour qu'ils soient triés au début
                    $ext_fichier = '';
                }
 
                if($ext_fichier != 'php' and $ext_fichier != 'html') {        //utile pour exclure certains types de fichiers à ne pas lister
                    array_push($fichier, $file);
                }
            }
        }
    }
 
    natcasesort($fichier);                                    //la fonction natcasesort( ) est la fonction de tri standard sauf qu'elle ignore la casse
 
    foreach($fichier as $value) {
 
            //echo '<a href="'.rawurlencode($repertoire).'/'.rawurlencode(str_replace ('/', '', $value)).'">'.$value.'</a><br/>';
 
 
            $filePHP= basename($_SERVER['SCRIPT_FILENAME']);    
            $racine_site = 'http://'.$_SERVER['SERVER_NAME'].str_replace ($filePHP, '', $_SERVER['SCRIPT_NAME']);
            echo '<item><title>'.$value.'</title><link>'.$racine_site.$value.'</link></item> <br/>';
 
 
            //http://php.net/manual/fr/reserved.variables.server.php
    }
 
}
 
//exemple d'utilisation :
 
echo '<?xml version="1.0" ?>';
echo '<rss version="2.0">';
echo '<channel>';
 
listing('.');        //chemin du dossier
 
echo '</channel>';
echo '</rss>';
 
 
?>

php rss

<iframe width="100%" height="1388" src="https://snippet.echosystem.fr?embed=553eb112d451d" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 28/04/2015

Flux RSS de cette page


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