群里有没有大神弄过常州电视台的php代理的
https://www.cztv.tv/channel.html群里有没有大神弄过常州电视台的php代理的,有的话能否给个地址!
<?php
function getStreamUrlById($id) {
$url = "https://kcz.cztv.tv/api/v1/channel/tv";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if (isset($data['errcode']) && $data['errcode'] === 0) {
foreach ($data['data']['data'] as $channel) {
if ($channel['id'] == $id) {
return $channel['stream_url'];
}
}
}
return null;
}
$id = isset($_GET['id']) ? intval($_GET['id']) : 1;
$stream_url = getStreamUrlById($id);
if ($stream_url) {
header("Location: " . $stream_url);
exit();
}
官网看不了吧!只能酒店组播了,或者找运营的看看 https://kcz.cztv.tv/api/v1/channel/tv
12358 发表于 2024-9-25 10:34
php?id=1 234 流年爱看剧 发表于 2024-9-25 10:10
https://kcz.cztv.tv/api/v1/channel/tv
强!谢谢! 12358 发表于 2024-9-25 10:34
官方版权问题,跟广东一样的,有版权问题的时候会暂停直播 做做好事 {:4_104:}
<?php
//常州tv
$id = !empty($_GET['id']) ? $_GET['id'] : 'czzh';
$n = [
'czzh' => 1, //常州综合
'czds' => 2, //常州都市
'czsh' => 3, //常州生活
'czgg' => 4, //常州公共
];
$json = json_decode(file_get_contents("https://kcz.cztv.tv/api/v1/channel/tv"));
header("Location: " .$json->data->data[$n[$id]-1]->stream_url);
?>
页:
[1]