|
本帖最后由 guoma 于 2023-10-14 12:00 编辑
- <?php
- $id = isset($_GET['id'])?$_GET['id']:'yczh';
- $fmt = isset($_GET['fmt'])?$_GET['fmt']:'';//hls,rtm
- $n = [
- 'yczh' => 1,//宜昌综合
- 'yclysh' => 2,//宜昌旅游生活
- ];
- if($fmt == ''||$fmt == 'hls'){
- $url = "http://www.3xgd.com/live/{$n[$id]}.html";
- $d = get($url);
- preg_match("|source:'(.*)'|", $d, $p);
- $playurl = $p[1];
- header('Content-Type: application/vnd.apple.mpegurl');
- header("location:".$playurl);
- //echo $playurl;
- }
- if($fmt == 'rtm'){
- $url = "http://www.3xgd.com/getaddr20211214/channelid/{$n[$id]}";
- $str = get($url);
- preg_match('|liveaddr="(.*)"|', $str, $d);
- $baseurl = openssl_decrypt($d[1], 'aes-128-cbc', 'nmkuferthyuj65r', OPENSSL_ZERO_PADDING, base64_decode('AXSDEHCbdfgfrtVGTGoREH=='));
- $playurl = trim(preg_replace("|refer=http://www.3xgd.com/live&|", "",$baseurl));
- header("Location:".$playurl);
- //echo $playurl;
- }
- function get($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_USERAGENT, 'Mozilla/5.0');
- curl_setopt($ch, CURLOPT_REFERER, "http://www.3xgd.com/live");
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- ?>
复制代码 |
|