|
|
发表于 2025-9-19 10:00:56
|
显示全部楼层
<?php
// http://kaniptv.com
//代码好像没几个台,id是数字11到14,自己测试<
$id = $_GET['id'];
$url = "https://cfpwwwapi.kbs.co.kr/api/v1/landing/live/channel_code/{$id}";
$headers = array(
'User-Agent: okhttp/3.12.11',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if(isset($data['ret']) && $data['ret'] == 0 && isset($data['channel_item'][0]['service_url'])) {
$service_url = $data['channel_item'][0]['service_url'];
header("Location: $service_url");
} else {
echo "Error occurred while fetching the stream URL.";
}
// http://kaniptv.com
?> |
|