找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1726|回复: 12

也发中国教育电视台php,请高手指教

[复制链接]
本帖最后由 guoma 于 2020-9-16 19:05 编辑

<?php
$id=$_GET["id"];
/* id=cetv1 cetv2 cetv3 cetv4 */
$basurl=file_get_contents('http://www.centv.cn/‘.$id.’/index.html');
//因CETV播放页面中直播id是动态的,先要获得其直播id。
preg_match('/data-vsrc="(.*?)"/',$basurl,$vurl);
$url=$vurl[1];
preg_match('/source src="(.*?)"/',file_get_contents($vurl[1]),$sm);
header('location:'.urldecode($sm[1]));
?>

点评

这样太麻烦了,只要四五行代码  发表于 2020-9-16 12:41
我的恩山、我的无线 The best wifi forum is right here.
低手子来看看
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
因CETV播放页面中直播id是动态的,过一段时间就变换,所以先要获得其直播id
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
大叔写个斗鱼的php
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

cetv();
function cetv(){
$id=$_GET["id"];/* id=cetv1 cetv2 cetv3 cetv4 */
$url=file_get_contents('http://www.centv.cn/'.$id.'/index.html');
preg_match('/data-vsrc="(.*?)"/',$url,$vurl);
preg_match('/source src="(.*?)"/',file_get_contents($vurl[1]),$sm);
header('location:'.urldecode($sm[1]));exit;
}

点评

谢谢指教!  详情 回复 发表于 2020-9-16 17:49
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
qqincai 发表于 2020-9-16 15:33
cetv();
function cetv(){
$id=$_GET["id"];/* id=cetv1 cetv2 cetv3 cetv4 */

谢谢指教!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

guoma 发表于 2020-9-16 17:49
谢谢指教!

你的代码漏了获取数据

点评

漏了 file_get_contents($vurl[1]) 我以为前面加了个‘容器’,后面就不用加了。 谢谢你啊!  详情 回复 发表于 2020-9-16 19:03
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
qqincai 发表于 2020-9-16 17:54
你的代码漏了获取数据

漏了 file_get_contents($vurl[1])
我以为前面加了个‘容器’,后面就不用加了。
谢谢你啊!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

看不懂,小学文化路过,打字辛苦了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
不懂,帮顶下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我没看错吧?‘.$id.’这单引号也成立?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 02:12

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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