-
Notifications
You must be signed in to change notification settings - Fork 8
/
server.php
30 lines (28 loc) · 832 Bytes
/
server.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* @author [email protected] @ 2021/7/28 下午1:55 For Shanghai-IPTV.
*/
define('SERVER_MODE', true);
$argv[1] = $_SERVER['QUERY_STRING'] ?? '';
$args = [];
parse_str($argv[1], $args);
$udpxy = $args['udpxy'] ?? null;
$fileName = $args['file'] ?? 'tel_mu';
$fileName = basename($fileName) . '.m3u8';
$m3u8 = null;
if (!file_exists($fileName)) {
$m3u8 = include './export.php';
if (empty($udpxy)) {
file_put_contents($fileName, $m3u8);
}
}
if (empty($udpxy)) {
header('Location: ' . $fileName);
exit();
}
if (empty($m3u8)) {
$m3u8 = file_get_contents($fileName);
}
header('Content-type:application/vnd.apple.mpegurl; charset=utf-8');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
echo str_replace('rtp://', rtrim($udpxy, ' \t\n\r') . '/rtp/', $m3u8);