有请大佬修复一下广州学堂代理
那位大佬能修复一下广州学堂代理<?php
/****************************************
食用方法:
随机学习高一数学一节课程:http://xxxxx/gzykt.php?id=&gid=951&sid=rand&type=sx
获取初三英语第二学期课程列表:http://xxxxx/gzykt.php?id=list&gid=824&sid=second&type=yyu
参数修改根据数组$grade和$sub和$ster的元素值自行组合即可。
*****************************************/
$id = isset($_GET['id'])?$_GET['id']:'list';
$gid = isset($_GET['gid'])?$_GET['gid']:'951';//年级,$grade数组定义的值进行替换
$sid = isset($_GET['sid'])?$_GET['sid']:'second';//学期,$ster数组定义的值进行替换
$type= isset($_GET['type'])?$_GET['type']:'sx';//科目,$sub数组定义的值进行替换
$ster=array(
'zero'=>'2',//第一二学期
'first'=>'0',//第一学期
'second'=>'1',//第二学期
);
$sub=array(
'yw'=>'语文',
'sx'=>'数学',
'yyu'=>'英语',
'wl'=>'物理',
'hx'=>'化学',
'ls'=>'历史',
'dl'=>'地理',
'swx'=>'生物学',
'sxzz'=>'思想政治',
'ddyfz'=>'道德与法治',
'kx'=>'科学',
'yyue'=>'音乐',
'ms'=>'美术',
'tyyjk'=>'体育与健康',
'zhsjhd'=>'综合实践活动',
'xljkjy'=>'心理健康教育',
'jttydl'=>'家庭体育锻炼',
'jtjy'=>'家庭教育',
'xxjs'=>'信息技术',
'tyjs'=>'通用技术',
);
$grade=array(
1029=>'小一',
105 =>'小二',
204 =>'小三',
286 =>'小四',
402 =>'小五',
511 =>'小六',
625 =>'初七',
713 =>'初八',
824 =>'初九',
951 =>'高一',
989 =>'高二',
);
if(empty($ster[$sid])||$sid=='rand'){
$sid=array_keys($ster);
}
if(empty($sub[$type])||$type=='rand'){
$type=array_keys($sub);
}
if(empty($grade[$gid])||$gid=='rand'){
$gid=array_keys($grade);
}
$header=array(
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'Referer: https://gzclass.gztv.com/gksubjecpc/',
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
);
if($id=='list'||$id==''){
$url='https://gzclass.gztv.com/hcEdu/pc/getGradeData?topColumnId='.$gid;
$info=json_decode(get_data($url,$header));
foreach ($info->data as $column){
if($column->columnName==$sub[$type]){
if($ster[$sid]==0||$ster[$sid]==2){
foreach ($column->children->children as $unit){
$Chapter=$unit->columnName;
foreach ($unit->courseList as $course){
$coursename=$course->courseName;
$uuid=$uids[]=$course->uuid;
if($id=='list'){
echo $coursename.',http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?id='.$uuid.'&sid=first&type='.$grade[$gid].$sub[$type].$Chapter.'</a><br>';
}
}
}
}
if($ster[$sid]==1||$ster[$sid]==2){
foreach ($column->children->children as $unit){
$Chapter=$unit->columnName;
foreach ($unit->courseList as $course){
$coursename=$course->courseName;
$uuid=$uids[]=$course->uuid;
if($id=='list'){
echo $coursename.',http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?id='.$uuid.'&sid=second&type='.$grade[$gid].$sub[$type].$Chapter.'</a><br>';
}
}
}
}
}
}
if(!$uuid){
echo '无数据,获取课程列表失败!';
}
if($uuid&&$id==null){
$id=$uids ;
}
}
if($id!=='list'&&$id!==null){
$url= 'https://gzclass.gztv.com/hcEdu/pc/getLessons?courseId='.$id;
$info=json_decode(get_data($url,$header));
$lesson=$info->data->list;
$name=$lesson->lessonName;
$gradeSubject=$lesson->gradeSubject;
$title=$lesson->answers->title;
if($id&&$info){
$lessonurl=$lesson->lessonLink.'?tag='.$name.'&type='.$gradeSubject;
$videourl=$lesson->answers->videoLink.'?tag='.$title.'&type='.$gradeSubject;
if($title){
$playurl=str_replace('https','http',array($lessonurl,$videourl));
}else{
$playurl=str_replace('https','http',$lessonurl);
}
}
//print_r($playurl);
header('location:'.$playurl);
}
function get_data($url,$header,$post=null){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
嗑瓜子,看直播。
页:
[1]