Create coto.php

added very simple proxy page in case it's usefull (or to bypass corp proxy to read a page without needing pics/css/scripts)
Cette révision appartient à :
Albirew 2020-10-13 15:46:26 +02:00
Parent a7c925a31f
révision edf9c1f1e7

74
coto.php Fichier normal
Voir le fichier

@ -0,0 +1,74 @@
<?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,
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;
}
if(isset($_GET['rss']))
{
$rss = $_GET['rss'];
if(!preg_match('/http[s]?:\/\//', $rss, $matches)) $rss = 'http://'.$rss;
header("Pragma: no-cache");
echo $rss;
}
else
{
echo '<!doctype html>
<html style="min-height: 100%;">
<head>
<meta charset="utf-8">
<title>proxy RSS</title>
<meta name="description" content=Proxy RSSn">
<style type="text/css">body,a:link,a:visited {color:#fff; text-shadow: 1px 1px 1px black;}</style>
</head>
<body style="margin: 0; background: linear-gradient(to bottom,#3a8dc8 0,#183a62 100%); line-height: 1.231;">
<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;">Proxy RSS</h1>
<h2 style="font-size:20px; text-align: right; margin: 0 0 10px 0;">rev.2<br><br>Mode d`emploi: Mettez l`URL complète du flux RSS que vous voulez, puis cliquez sur GO!.<br></h2>
<div style="text-align: center; margin: 0;"><form method="get" action="coto_rss.php">
<input type="text" placeholder="website.com/page.html" size="50" name="rss"/>
<button type="submit" value="1">GO!</button>
</form></div>
<div style="margin-top: 2em; background-image: url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABVJREFUeNpiuH79+jWG////nwEIMAAi+QclPGli9AAAAABJRU5ErkJggg==\'); width: 780px; height:2px; margin: 0 auto;"></div>
</div>
<div style="background:black; position:absolute; bottom:0; width:100%; padding-bottom:5px; padding-left:5px; font:15px Courier New; font-size:30px;">
<a href="https://twitter.com/albirew">Albirew</a> - <a href="https://github.com/Albirew/coto_rss">code source</a>
</div>
</body>
</html>';
}
?>