找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 19111|回复: 263

[iptv信源 资源分享或寻求] 云南昆广PHP代码(可查询EPG和回看)

 火... [复制链接]
发表于 2022-4-14 20:11 | 显示全部楼层 |阅读模式
代码示例:
直播:kmgd.php?id=060(&type=live)
(注:“&type=live”可有可无)
节目单:kmgd.php?id=060&type=epg

回看(不支持定时回看):kmgd.php?type=back&start=20220414190009&end=20220414193010&event_id=209737646(此为节目单中某链接里获取到的链接)
ID文件:
代码回复可见:
  1. <?php
  2. $head_httpdvb = 'http://httpdvb.slave.96599.cn:14311';
  3. $head_httpstream = 'http://stream.slave.96599.cn:14311';

  4. function getcurl($url){
  5. $user_agent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)";
  6. $ch = curl_init();
  7. //curl_setopt ($ch, CURLOPT_PROXY, $proxy);
  8. curl_setopt ($ch, CURLOPT_URL, $url);//设置要访问的IP
  9. curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);//模拟用户使用的浏览器
  10. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1 ); // 使用自动跳转
  11. curl_setopt ($ch, CURLOPT_TIMEOUT, 60); //设置超时时间
  12. curl_setopt ($ch, CURLOPT_AUTOREFERER, 1 ); // 自动设置Referer
  13. curl_setopt ($ch, CURLOPT_HEADER,0); //显示返回的HEAD区域的内容
  14. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
  16. curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
  17. $result = curl_exec($ch);
  18. curl_close($ch);
  19. return $result;
  20. }

  21. function getinfo_json($chnlid,$token){
  22.     $i_url = 'http://slave.96599.cn:13160/media/channel/get_info?chnlid=4200000'.$chnlid.'&accesstoken='.$token;
  23.     $i_result = file_get_contents($i_url);
  24.     return json_decode($i_result);
  25. }
  26. $accesstoken='R5EEFBFB6U309400ECK7735953DI9FB1EF78PBM300C495V0Z816B5W161AA85172C19FEB';

  27. $id=isset($_GET['id'])?$_GET['id']:'060';
  28. $type=isset($_GET['type'])?$_GET['type']:'live';

  29. if($type=='live'){
  30.     //直播
  31.     header("ACCESS-CONTROL-ALLOW-ORIGIN:*");
  32.     header("Content-type: application/x-mpegURL");
  33.     $json = getinfo_json($id,$accesstoken);
  34.     $playtoken = isset($json->play_token)?$json->play_token:'ABCDEFGHI';
  35.     $playurl=$head_httpdvb.'/playurl?playtype=live&protocol=hls&accesstoken='.$accesstoken.'&programid=4200000'.$id.'&playtoken='.$playtoken;
  36.     $m3u8 =getcurl($playurl);
  37.     echo preg_replace('/(http):\/\/([^\/]+)/i',$head_httpdvb,$m3u8);
  38. }else if($type=='epg'){
  39.     //节目单
  40.     $date=isset($_GET['date'])?$_GET['date']:date('Y-m-d');
  41.     $time = time();
  42.     $json = getinfo_json($id,$accesstoken);
  43.     echo $json->chnl_name." ".$date." 节目单<br/>";
  44.     $list_url='http://slave.96599.cn:13160/media/event/get_list?chnlid=4200000'.$id.'&pageidx=1&vcontrol=0&attachdesc=1&repeat=1&accesstoken='.$accesstoken.'&starttime='.strtotime($date).'&endtime='.strtotime('+1 day',strtotime($date)).'&pagenum=100&flagposter=0';
  45.     $list_result = file_get_contents($list_url);
  46.     $list_json = json_decode($list_result);
  47.     $event_list=$list_json->event_list;
  48.     $php_Self = substr($_SERVER['PHP_SELF'],strripos($_SERVER['PHP_SELF'],"/")+1);
  49.     for ($x=0; $x<count($event_list); $x++) {
  50.         $url=$php_Self.'?type=back&start='.date('YmdHis',$event_list[$x]->start_time).'&end='.date('YmdHis',$event_list[$x]->end_time).'&event_id='.$event_list[$x]->event_id;
  51.         $n=date('H:i',$event_list[$x]->start_time).' '.$event_list[$x]->event_name;
  52.         if(number_format($time)>number_format($event_list[$x]->end_time)){
  53.             echo "<a href='{$url}' title=''>$n</a><br/>";
  54.         }else{
  55.             echo $n."<br/>";
  56.         }
  57.     }
  58. }else if($type=='back'){
  59.     //回看
  60.     header("ACCESS-CONTROL-ALLOW-ORIGIN:*");
  61.     header("Content-type: application/x-mpegURL");
  62.     $start=$_GET['start'];
  63.     $end=$_GET['end'];
  64.     $eventid=$_GET['event_id'];
  65.     $url='http://slave.96599.cn:13160/media/event/get_info?accesstoken='.$accesstoken.'&eventid='.$eventid;
  66.     $result = file_get_contents($url);
  67.     $json = json_decode($result);
  68.     $_playtoken = $json->play_token;
  69.      $playurl=$head_httpstream.'/playurl?playtype=lookback&protocol=hls&starttime='.$start.'&endtime='.$end.'&accesstoken='.$accesstoken.'&programid='.$eventid.'&playtoken='.$_playtoken;
  70.     $m3u8 =getcurl($playurl);
  71.     echo preg_replace('/(http):\/\/([^\/]+)/i',$head_httpstream,$m3u8);
  72. }
  73. ?>
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-4-14 20:16 | 显示全部楼层
看看怎么样
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:19 | 显示全部楼层
看看是啥格式的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:19 来自手机 | 显示全部楼层
谢谢楼主的分享!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:21 | 显示全部楼层
看看怎么样........
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:22 | 显示全部楼层
感谢分享 ..
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:22 来自手机 | 显示全部楼层
卡的看不了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:31 | 显示全部楼层
感谢分享。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:32 | 显示全部楼层
这个还能看吗、
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:33 | 显示全部楼层
本帖最后由 cxjys 于 2022-4-14 20:44 编辑

太卡卡了,单感谢你的分享NB
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:33 | 显示全部楼层
看看怎么样
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:35 | 显示全部楼层
云南昆广PHP代码(可查询EPG和回看)
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:35 | 显示全部楼层
谢谢楼主分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:38 | 显示全部楼层
感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-14 20:38 | 显示全部楼层
谢谢楼主的分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-19 16:33

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表