找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1315|回复: 7

[网络视频应用推荐 使用 疑问] 求助:请坛内高手看看问题出在哪里?

[复制链接]
发表于 2022-9-27 11:57 | 显示全部楼层 |阅读模式
本人写了个云南电视台php,能获取数据,但不能播放,不知哪儿妯了毛病,请坛内大师指点一二:

  1. <?php
  2. $id = isset($_GET['id'])?$_GET['id']:'ynws';
  3. $n = [
  4.   'ynws' => 'yunnanweishi',
  5.   'ynds' => 'yunnandushi',
  6.   'ynyl' => 'yunnanyule',
  7.   'yngg' => 'yunnangonggong',
  8.   'yngj' => 'yunnanguoji',
  9.   'ynse' => 'yunnanshaoer',
  10.   'ynsh' => 'yunnanshenghuo',
  11.    ];
  12. $r = 'http://www.yntv.cn/live.html';

  13. $url = 'https://api.yntv.ynradio.com/index/jmd/getRq?name='.$n[$id];
  14. $d = json_decode(getdata($url,$r));
  15. $name = $d->url;
  16. $string = $d->string;
  17. $time = $d->time;

  18. $purl = 'http://tvlive.yntv.cn'.$name.'?wsSecret='.$string.'&wsTime='.$time;
  19. //echo $purl;

  20. if (empty($_GET['ts'])){
  21. print_r(preg_replace("/(.*?.ts)/i","yntv.php?ts=$1",getdata($purl,$r)));
  22. } else {
  23.   $ts = getdata("http://tvlive.ynradio.com/live/".$n[$id]."/".$_GET['ts'],$r);
  24.   echo $ts;
  25.   }

  26. function getdata($url,$ref){
  27. $h = ["User-Agent: Mozilla/5.0 (Windows NT 6.1)","Referer: http://www.yntv.cn/live.html"];            
  28.     $ch = curl_init($url);
  29.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  30.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  31.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  32.     curl_setopt($ch, CURLOPT_HTTPHEADER, $h);
  33.     curl_setopt($ch, CURLOPT_REFERER, $ref);
  34.     $result = curl_exec($ch);
  35.     curl_close($ch);
  36.     return $result;
  37. }
  38. ?>
复制代码


我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-9-27 12:43 来自手机 | 显示全部楼层
有拦截吧?

本帖子中包含更多资源

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

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-9-27 12:52 | 显示全部楼层
云南不用UA了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-9-27 12:53 | 显示全部楼层
你的服务器可能出现问题了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-9-27 13:33 | 显示全部楼层
  1. <?php
  2.     $id = isset($_GET['id']) ? $_GET['id'] : 'ynws';
  3.     $n = [
  4.         'ynws' => 'yunnanweishi',
  5.         'ynds' => 'yunnandushi',
  6.         'ynyl' => 'yunnanyule',
  7.         'yngg' => 'yunnangonggong',
  8.         'yngj' => 'yunnanguoji',
  9.         'ynse' => 'yunnanshaoer',
  10.         'ynsh' => 'yunnanshenghuo',
  11.     ];
  12.     $domain = "tvlive.yntv.cn";
  13.     $r = 'http://www.yntv.cn/live.html';
  14.     if (empty($_GET['ts'])) {
  15.         $url = 'https://api.yntv.ynradio.com/index/jmd/getRq?name=' . $n[$id];
  16.         $d = json_decode(getdata($url, $r));
  17.         $name = $d->url;
  18.         $string = $d->string;
  19.         $time = $d->time;
  20.         $purl = "http://" . $domain . $name . '?wsSecret=' . $string . '&wsTime=' . $time;
  21.         die(preg_replace("/(.*?.ts)/i", $_SERVER['SCRIPT_NAME'] . "?ts=$1", getdata($purl, $r)));
  22.     } else {
  23.         $ts = getdata("http://" . $domain . "/live/" . $n[$id] . "/" . $_GET['ts'], $r);
  24.         die($ts);
  25.     }
  26.     function getdata($url, $ref)
  27.     {
  28.         $h = ["User-Agent: Mozilla/5.0 (Windows NT 6.1)", "Referer: http://www.yntv.cn/live.html"];
  29.         $ch = curl_init($url);
  30.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  31.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  32.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  33.         curl_setopt($ch, CURLOPT_HTTPHEADER, $h);
  34.         curl_setopt($ch, CURLOPT_REFERER, $ref);
  35.         $result = curl_exec($ch);
  36.         curl_close($ch);
  37.         return $result;
  38.     }
  39. ?>
复制代码
两个域名不一样

点评

谢谢你,可以了。  详情 回复 发表于 2022-9-27 18:45
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-9-27 17:01 | 显示全部楼层
之前可以正常播放 就是第一次发这个代码的时候 往后就不知道什么时候失效了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-9-27 18:45 | 显示全部楼层
jacky77 发表于 2022-9-27 13:33
两个域名不一样

谢谢你,可以了。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-9-27 21:59 | 显示全部楼层
是不是失效了啊?我上传到服务器上,调用不了呢?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-19 14:52

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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