coto_rss/coto_rss.php

89 lignes
84 Kio
PHP
Brut Vue normale Historique

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.
* ----------------------------------------------------------------------------
*/
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,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_AUTOREFERER => true,
CURLOPT_SSL_VERIFYPEER => 0,
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)
{
$source = better_file_get_content($url)[content];
$corrige = stristr($source, '<?xml');
$corrige = str_replace("" , "", $corrige);
$corrige = str_replace("" , "", $corrige);
$corrige = str_replace("" , "", $corrige);
$corrige = str_replace("" , "", $corrige);
ini_set('mbstring.substitute_character', "none");
$corrige = mb_convert_encoding($corrige, 'UTF-8', 'UTF-8');
return $corrige;
}
2013-11-24 21:28:48 +01:00
if(isset($_GET['rss']))
{
$rss = $_GET['rss'];
if(!preg_match('/http[s]?:\/\//', $rss, $matches)) $rss = 'http://'.$rss;
header("Pragma: no-cache");
header("Content-type: application/rss+xml");
echo clean_rss($rss);
}
2013-11-24 21:28:48 +01:00
else
{
echo '<!doctype html>
2013-11-24 21:28:48 +01:00
<html>
<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">
<style type="text/css">a:link {color:#B03030;}</style>
</head>
<body style="margin: 0; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAA8BtJREFUeNpsnYGS4zjOpElKrurduHv/B72L/ae7LPIkfMgk3HsTG7M91S5blkgQSCQy+3/+7/9da833u7U2ej++vq6fn34c97/bWsfr9b7/czz/zOu6/9B7v97v+9/Hea7W7j+sOe8/8IJx/+KfP8+/329ecP/w9fV1v/n9k/tF6/0+v7/vT2xzPr98HPPnZ5zn/Vkt/nne8/7fGO15UVvxsvtNWnzE83H3j+//9X5/yn3Zz7Udx8/7PdrzG88P7+u8/4l3e8/Z44f338057w9a8S3uV173e94/uT/ofv/7zeMDenzi4Ovf7zGel/b7t9Z6//nz+v6+P/H+xfsPvOC4X3ld5+v15/7WPf9ZcXl8o/ti7v+7X/Bc3P0mcVfvG3K/y/1Z968/F3n/7uv18+fPeZ73T/7n//yfX//7f9+3Zd1vErf3vpP84Xkix8FdvT/o/jp8zXjvxf89Hx037bkV93e/v0G8eMb9v394/+/+RB4l9/m6v3Jc5Pv9vn+lN57MseKm3a857ocb//G8Pi77ecP7P+/FEF9wxLeOu7X4Qz7x+Oe5kvuS9E/ngd6vi8fEWz1vO8Z9Jc/F37flumashPua//z+/fX9fX/AjG/KA51xN54Heq/P83wuIL7jEQ9rxU25P4X37PGpMxbqfZP5Fqzkk2d2/5gN0OOp55O8Xzfujzhb/ML95XINvl491k2Pm37/mS+Xv3bfneM47xfyMfEw8nvfvxGPvMduyd+NNfpccDynFv/jb/mt5nsa/8eS6tz9uF+v+23vJxd3k8XxrP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C61jHgtYQtZJF6P5L76xje5cV3MLufpeCII3bR/cc3BebXVzfMperZCSGHZI+DtRsnMGhby30DIDooDh9xziEFYh4R9oaelivsplycBZ35oRN0JbRcAavfqBGHzCq1U94xrjDOMZePekWp+2MzjJK1PnsGZDkC6AxIjT9wMS8lV0PVbW5yJdikyq42l+4e6HxTPbO083k9S8JJQU0sDUNz4OQKISRxMuhenU+GRROA6iEwzU5sA7KMWJJxOnatM9Gh06QLbGk8fs67qIgTrACNCqyjC/a6AyrFk5NL5w9GhAJNmFdc+hFAHl2LFWvuzn05+FZ8C3bd+y42Yvne0euK05mYl7mKDpYsduN4JVA5n8wNqcJxlDz/ODNp7K4BXNMKUO7abHxNUHPjqtyQJy29L1sZBSki6PvlsAfUDSTKIpjTqeDzEeDf953hzUGQiSA8kTj66Y1w1DupI3gl2EqrJACZFl2awwFbwZugMHRe7bInf3xMgU49/vdETErhSGleWjkUb8CmTr9pBbjPkyWWUikysVz3AcqrpFO2Fju2c6B5HVJ2B046iP06f7qQj3tJnMbafaQOJWdGAIb2a9f7upDnEveJrDuyQ6MynHpmrZoFgn+Tk1FoOgnmMUd65yxosccicIJt3/d3xtohFzzzq2fPwetuUbQYJhFCcgr/7Woy5Emiw5Cq9Nlg950wrvfnz/PKr6+nL8Yv8owjgpLJDJpWsUCpHJdbVFGoZGC+9/N5vhXt7need0Ue+DoRgTLO9UaeirEfpivwKAae64x6lxXTK/albWxMbBnw9Womw4kKkhck8sv57BpaxQCH8NPg4z+ivnoygljO7+gVEteeSHTvbTYACZWAyCPOCk6PPF44QnWdV8S4HrX+8QkhjgIAUsxwcnYdqsYVD2oAgf6OF6f/tFNz7uN9HQEguCGQqVs0C30+DhousaUoQ
<div style="margin:0 0 1px 0; background-image: url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAPCAYAAAAlH6X5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEBJREFUeNpieJdb9J+JAQggxO///xmYvv//x8D08d8/BoY/f/58YfgPBGBZ5hs3bmwGsZ6DiPcg4gdIFqIXIMAAfOwcqLCrkOQAAAAASUVORK5CYII=\'); height: 15px;"></div>
<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>
<h2 style="font-size:20px; text-align: right; margin: 0 0 10px 0;">rev.18<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>
<div style="background-image: url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABVJREFUeNpiuH79+jWG////nwEIMAAi+QclPGli9AAAAABJRU5ErkJggg==\'); width: 780px; height:2px; margin: 0 auto;"></div>
</div>
<div style="position:fixed; bottom:5px; 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>';
}
2013-11-24 21:28:48 +01:00
?>