36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
// IPTV 流代理 —— App 经此中转拉 FLV,绕开 Referer/CF/DNS 难题
|
|
set_time_limit(0);
|
|
@ini_set('zlib.output_compression', '0');
|
|
@ini_set('output_buffering', 'off');
|
|
while (ob_get_level() > 0) ob_end_flush();
|
|
|
|
$playUrl = $_GET['url'] ?? '';
|
|
if (!$playUrl || !preg_match('#^https://p\.iptv200\.com/play\.php#', $playUrl)) {
|
|
http_response_code(400); echo 'bad url'; exit;
|
|
}
|
|
|
|
$ch = curl_init($playUrl);
|
|
header('Content-Type: video/x-flv');
|
|
header('Cache-Control: no-cache');
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_MAXREDIRS => 5,
|
|
CURLOPT_TIMEOUT => 0,
|
|
CURLOPT_CONNECTTIMEOUT => 10,
|
|
CURLOPT_USERAGENT => 'Mozilla/5.0 (Linux; Android 12) Chrome/124 Mobile Safari/537.36',
|
|
CURLOPT_REFERER => 'https://m.iptv807.com/',
|
|
CURLOPT_SSL_VERIFYPEER => false,
|
|
CURLOPT_HEADERFUNCTION => function($ch, $hdr) {
|
|
if (preg_match('/^(Content-Type|Content-Length)/i', $hdr)) header(rtrim($hdr));
|
|
return strlen($hdr);
|
|
},
|
|
CURLOPT_WRITEFUNCTION => function($ch, $data) {
|
|
echo $data;
|
|
if (function_exists('flush')) flush();
|
|
return strlen($data);
|
|
},
|
|
]);
|
|
curl_exec($ch);
|
|
curl_close($ch);
|