2013-11-24 21:28:48 +01:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
* « LICENCE BEERWARE » (Révision 42):
|
|
|
|
|
* <romain@albirew.fr> a créé ce fichier. Tant que vous conservez cet avertissement,
|
|
|
|
|
* vous pouvez faire ce que vous voulez de ce truc. Si on se rencontre un jour et
|
|
|
|
|
* que vous pensez que ce truc vaut le coup, vous pouvez me payer une bière en
|
|
|
|
|
* retour.
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
*/
|
2021-04-22 22:56:13 +02:00
|
|
|
|
$revision='21';
|
2015-01-08 18:08:10 +01:00
|
|
|
|
function better_file_get_content($url)
|
|
|
|
|
{
|
|
|
|
|
$user_agent='Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0';
|
|
|
|
|
$options = array(
|
|
|
|
|
CURLOPT_CUSTOMREQUEST =>"GET",
|
|
|
|
|
CURLOPT_POST =>false,
|
2017-06-04 14:53:46 +02:00
|
|
|
|
CURLOPT_USERAGENT => $user_agent,
|
2015-01-08 18:08:10 +01:00
|
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
|
|
CURLOPT_HEADER => false,
|
|
|
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
|
|
|
CURLOPT_ENCODING => "",
|
|
|
|
|
CURLOPT_AUTOREFERER => true,
|
2019-12-31 14:30:45 +01:00
|
|
|
|
CURLOPT_SSL_VERIFYPEER => 0,
|
2015-01-08 18:08:10 +01:00
|
|
|
|
CURLOPT_CONNECTTIMEOUT => 120,
|
|
|
|
|
CURLOPT_TIMEOUT => 120,
|
|
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
|
|
);
|
|
|
|
|
$ch = curl_init( $url );
|
|
|
|
|
curl_setopt_array( $ch, $options );
|
|
|
|
|
$content = curl_exec( $ch );
|
|
|
|
|
$err = curl_errno( $ch );
|
|
|
|
|
$errmsg = curl_error( $ch );
|
|
|
|
|
$header = curl_getinfo( $ch );
|
|
|
|
|
curl_close( $ch );
|
|
|
|
|
$header['errno'] = $err;
|
|
|
|
|
$header['errmsg'] = $errmsg;
|
|
|
|
|
$header['content'] = $content;
|
|
|
|
|
return $header;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clean_rss($url)
|
|
|
|
|
{
|
2021-04-22 22:56:13 +02:00
|
|
|
|
$source = better_file_get_content($url);
|
|
|
|
|
$corrige = stristr($source['content'], '<?xml');
|
2015-01-08 18:08:10 +01:00
|
|
|
|
$corrige = str_replace("" , "", $corrige);
|
|
|
|
|
$corrige = str_replace("" , "", $corrige);
|
|
|
|
|
$corrige = str_replace("" , "", $corrige);
|
|
|
|
|
$corrige = str_replace("" , "", $corrige);
|
2018-06-24 13:49:44 +02:00
|
|
|
|
ini_set('mbstring.substitute_character', "none");
|
|
|
|
|
$corrige = mb_convert_encoding($corrige, 'UTF-8', 'UTF-8');
|
2015-01-08 18:08:10 +01:00
|
|
|
|
return $corrige;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-24 21:28:48 +01:00
|
|
|
|
if(isset($_GET['rss']))
|
2015-01-08 18:08:10 +01:00
|
|
|
|
{
|
|
|
|
|
$rss = $_GET['rss'];
|
|
|
|
|
if(!preg_match('/http[s]?:\/\//', $rss, $matches)) $rss = 'http://'.$rss;
|
|
|
|
|
header("Pragma: no-cache");
|
|
|
|
|
echo clean_rss($rss);
|
|
|
|
|
}
|
2013-11-24 21:28:48 +01:00
|
|
|
|
else
|
2015-01-08 18:08:10 +01:00
|
|
|
|
{
|
|
|
|
|
echo '<!doctype html>
|
2020-10-13 16:02:47 +02:00
|
|
|
|
<html style="min-height: 100%;">
|
2013-11-24 21:28:48 +01:00
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<title>Correcteur de RSS pour sites web en carton</title>
|
|
|
|
|
<meta name="description" content="Correcteur de RSS pour sites web en carton">
|
2020-10-13 16:02:47 +02:00
|
|
|
|
<style type="text/css">body,a:link,a:visited {color:#fff; text-shadow: 1px 1px 1px black;}</style>
|
2013-11-24 21:28:48 +01:00
|
|
|
|
</head>
|
2021-04-22 22:56:13 +02:00
|
|
|
|
<body style="margin: 0; background: linear-gradient(to bottom,#3a8dc8 0,#183a62 100%); line-height: 1.337;">
|
2013-11-24 21:28:48 +01:00
|
|
|
|
<div style="width: 910px; margin: 0 auto;">
|
|
|
|
|
<h1 style="font-size:220%; letter-spacing: 1px; text-align: center; margin: 0; text-decoration:underline; font-weight:bold;">Correcteur de RSS pour sites web en carton</h1>
|
2021-04-22 22:56:13 +02:00
|
|
|
|
<h2 style="font-size:20px; text-align: right; margin: 0 0 10px 0;">rev.'.$revision.'<br>Enlève certains caractères invisibles qui malforment les flux RSS (peux servir aussi de proxy RSS)<br><br>Mode d`emploi: Mettez l`URL complète du flux RSS que vous voulez, puis cliquez sur GO!.<br></h2>
|
2013-11-24 21:28:48 +01:00
|
|
|
|
<div style="text-align: center; margin: 0;"><form method="get" action="coto_rss.php">
|
2019-07-27 14:52:41 +02:00
|
|
|
|
<input type="text" placeholder="website.com/rss.php?id=news" size="50" name="rss"/>
|
2013-11-24 21:28:48 +01:00
|
|
|
|
<button type="submit" value="1">GO!</button>
|
|
|
|
|
</form></div>
|
2020-10-13 16:02:47 +02:00
|
|
|
|
<div style="background-color: #fff; width: 780px; height:2px; margin: 2em auto;"></div>
|
2013-11-24 21:28:48 +01:00
|
|
|
|
</div>
|
2020-10-13 16:02:47 +02:00
|
|
|
|
<div style="background:black; position:absolute; bottom:0; width:100%; padding-bottom:5px; padding-left:5px; font:15px Courier New; font-size:30px;">
|
2017-06-04 14:53:46 +02:00
|
|
|
|
<a href="https://twitter.com/albirew">Albirew</a> - <a href="https://github.com/Albirew/coto_rss">code source</a>
|
2013-11-24 21:28:48 +01:00
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>';
|
2015-01-08 18:08:10 +01:00
|
|
|
|
}
|
2013-11-24 21:28:48 +01:00
|
|
|
|
?>
|