|
- <?php
- error_reporting(0);
- $id = isset($_GET['id'])?$_GET['id']:'cetv2';
- $n = [
- 'cetv1' => 417964,
- 'cetv2' => 437696,
- 'cetv3' => 445986,
- 'cetv4' => 445987,
- ];
- $url = "http://m.cetv.cn/ajax/playinfo";
- $post = "id={$n[$id]}&appid=11";
- $live = json_decode(get($url,$post),1)['data']['player'][0]['m3u8'];
- header('Content-Type: application/vnd.apple.mpegurl');
- print_r(preg_replace("/(.*?.ts)/i", "http://keybl.centv.cn/live/$1",m3u8($live)));
- function get($url,$post){
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- function m3u8($url){
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_HTTPHEADER, ["Referer: app.cetv.cn"]);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- ?>
复制代码
|
评分
-
查看全部评分
|