|
四川达州php,回复可见。
调用ID
达州新闻综合 FHD,http://.../xxx.php?id=1
达州公共 FHD,http://.../xxx.php?id=2
达州通川 FHD,http://.../xxx.php?id=3
- <?php
- $phpself = substr($_SERVER['PHP_SELF'],strripos($_SERVER['PHP_SELF'],"/")+1);
- $r = 'http://www.dzxw.net/';
- $fmt = isset($_GET['fmt'])?$_GET['fmt']:'hls';
- $id = isset($_GET['id'])?$_GET['id']:1;
- $ids = array(
- "1" =>"channel104234", //达州新闻综合
- "2" =>"channel104727", //达州公共
- "3" =>"channel105011", //达州通川
- );
- if (empty($ids[$id])) { $id = 1;}
- if($fmt=='hls'){
- $apiurl = "http://m3u8.channellive.dzxw.net/nmip-media/channellive/$ids[$id]/playlist.m3u8";
- echo preg_replace("/(.*?.ts)/i",$phpself."?fmt=ts&ts=$ids[$id]/$1",m3u8($apiurl,$r));
- }else if($fmt=='ts'){
- header("Content-type: video/mp2t");
- $ts = $_GET['ts'];
- $data = ts("http://m3u8.channellive.dzxw.net/nmip-media/channellive/".trim($ts),$r);
- }
- function m3u8($url,$ref){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
- curl_setopt($ch, CURLOPT_REFERER, $ref);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- function ts($url,$ref){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
- curl_setopt($ch, CURLOPT_REFERER, $ref);
- $result = curl_exec($ch);
- curl_close($ch);
- }
- ?>
复制代码
另附:固定地址如下
- 达州新闻综合 FHD,rtmp://tv.drs.dzxw.net/channellive/xwzhpd-dz1
- 达州新闻综合 FHD,[flash]http://tv.drs.dzxw.net/channellive/xwzhpd-dz1.flv[/flash]
- 达州公共 FHD,rtmp://tv.drs.dzxw.net/channellive/ggpd-dz2
- 达州公共 FHD,[flash]http://tv.drs.dzxw.net/channellive/ggpd-dz2.flv[/flash]
- 达州通川 FHD,rtmp://tv.drs.dzxw.net/channellive/tcpd-dz3
- 达州通川 FHD,[flash]http://tv.drs.dzxw.net/channellive/tcpd-dz3.flv[/flash]
复制代码
<font color="#ff0000">小水管慎用:由于达州的ts也是带referer的,本质上要耗费服务器的流量资源,如无好空间可以本机自行安装php解析或者用固定地址收看。</font>
防杠说明:其实上面也有附固定地址的。只不过有坛友要。
|
|