贵州习水电视台
习水电视台源码<?php// 获取 id 参数,如果未设置则默认为 'xszh'
$id = isset($_GET['id']) ? $_GET['id'] : 'xszh';
$n = [
'xsjj' => 'https://ali-live.xishuirm.cn/live/app3.m3u8', // 习水经济
'xszh' => 'https://ali-live.xishuirm.cn/live/app2.m3u8', // 习水综合
];
$url = isset($n[$id]) ? $n[$id] : $n['xszh'];
$auth_url = "http://nn.7x9d.cn/地方台/小曾.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $auth_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$auth_response = curl_exec($ch);
curl_close($ch);
$Authorization = trim($auth_response);
if (empty($Authorization)) {
die("Error: Unable to fetch Authorization token.");
}
$api_url = "http://api-cms.xishuirm.cn/v1/mobile/channel/play_auth/?stream=" . urlencode($url);
$headers = [
"Authorization: $Authorization",
'Host: api-cms.xishuirm.cn',
'Connection: Keep-Alive',
'Accept-Encoding: gzip',
'User-Agent: okhttp/3.11.0'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status_code == 200) {
if (substr($response, 0, 2) === "\x1f\x8b") {
$response = gzinflate(substr($response, 10, -8));
}
$decoded_response = json_decode($response, true);
if (isset($decoded_response['data']['auth_key'])) {
$auth_key = $decoded_response['data']['auth_key'];
$stream_url = "$url?auth_key=$auth_key";
header("Location: $stream_url");
exit;
} else {
die("Error: Authorization key not found in the response.");
}
} else {
die("Error: Failed to get authorization with status code $status_code.");
}
?>
感谢分享 习水电视台源码 十分感谢 http://nn.7x9d.cn/地方台/小曾.php{:4_95:} 这个怎么用?求解
页:
[1]