sendalo/sendalo.php.tpl

36 lines
992 B
Smarty
Raw Normal View History

2020-06-16 21:02:53 +00:00
<?php
2020-06-17 09:33:34 +00:00
$alldata = "";
function curl_callback($handle, $data) {
global $alldata;
$alldata .= $data;
if (strlen($alldata) > 150000) {
die();
}
else return strlen($data);
}
2020-06-16 21:02:53 +00:00
if (isset($_REQUEST["url"])) {
2020-06-16 21:53:56 +00:00
$url = $_REQUEST["url"];
2020-06-17 09:33:34 +00:00
if (
substr($url, 0, strlen('http://')) !== 'http://'
&& substr($url, 0, strlen('https://')) !== 'https://'
) die();
$ch = curl_init($url);
$headers = array('X-Forwarded-For: ' . $_SERVER['REMOTE_ADDR']);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt ($ch, CURLOPT_WRITEFUNCTION, 'curl_callback');
curl_exec($ch);
2020-06-16 21:53:56 +00:00
header('Content-type: application/octet-stream');
2020-06-17 09:33:34 +00:00
file_put_contents("php://output", $alldata);
2020-06-16 21:53:56 +00:00
2020-06-16 21:02:53 +00:00
die();
}
?>