网易云视频直播php版api
跳至 [1] [全屏预览]
AppKey = $AppKey; $this->AppSecret = $AppSecret; } /**生成验证码**/ public function checkSumBuilder(){ //此部分生成随机字符串 $hex_digits = self::HEX_DIGITS; $this->Nonce; for($i=0;$iNonce.= $hex_digits[rand(0,15)]; } $this->CurTime = (string)(time()); //当前时间戳,以秒为单位 $join_string = $this->AppSecret.$this->Nonce.$this->CurTime; $this->CheckSum = sha1($join_string); } /*****post请求******/ public function postDataCurl($url,$data=array()){ $this->checkSumBuilder(); //发送请求前需先生成checkSum if(!empty($data)){ $json=json_encode($data); }else{ $json=""; } $timeout = 5000; $http_header = array( 'AppKey:'.$this->AppKey, 'Nonce:'.$this->Nonce, 'CurTime:'.$this->CurTime, 'CheckSum:'.$this->CheckSum, 'Content-Type: application/json;charset=utf-8;', 'Content-Length: ' . strlen($json) ); $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $json); curl_setopt ($ch, CURLOPT_HEADER, false); curl_setopt ($ch, CURLOPT_HTTPHEADER,$http_header); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER,false); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); if (false === $result) { $result = curl_errno($ch); } curl_close($ch); return json_decode($result,true) ; } /***频道添加***/ public function channel_add($name,$type=0){ $url="https://vcloud.163.com/app/channel/create"; return $data=$this->postDataCurl($url,array("name"=>$name,"type"=>$type)); } /****频道更新*****/ public function channel_update($name,$cid,$type=0){ $url="https://vcloud.163.com/app/channel/update"; return $data=$this->postDataCurl($url,array("name"=>$name,"cid"=>$cid,"type"=>$type)); } /****频道删除******/ public function channel_delete($cid){ $url="https://vcloud.163.com/app/channel/delete"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } /****获取频道信息******/ public function channel_get($cid){ $url="https://vcloud.163.com/app/channelstats"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } /*** 获取频道列表 records int 单页记录数,默认值为10 否 pnum int 要取第几页,默认值为1 否 ofield String 排序的域,支持的排序域为:ctime(默认) 否 sort int 升序还是降序,1升序,0降序,默认为desc 否 **/ public function channel_list($option=array("records"=>10,"pnum"=>1,"ofield"=>"ctime","sort"=>1)){ $url="https://vcloud.163.com/app/channellist"; return $data=$this->postDataCurl($url,$option); } /**重新获取推流地址***/ public function channel_reset($cid){ $url="https://vcloud.163.com/app/address"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } /***** 设置频道为录制状态 cid String 频道ID 是 needRecord int 1-开启录制; 0-关闭录制 是 format int 1-flv; 0-mp4 是 duration int 录制切片时长(分钟),默认120分钟 否 filename String 录制后文件名,格式为filename_YYYYMMDD-HHmmssYYYYMMDD-HHmmss, 文件名录制起始时间(年月日时分秒) -录制结束时间(年月日时分秒) 否 ****/ public function channel_setRecord($cid,$option=array()){ $url="https://vcloud.163.com/app/channel/setAlwaysRecord"; return $data=$this->postDataCurl($url,$option); } /****暂停频道*****/ public function channel_pause($cid){ $url="https://vcloud.163.com/app/channel/pause"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } /****批量暂停频道****/ public function channel_pauselist($cidList){ $url="https://vcloud.163.com/app/channellist/pause"; return $data=$this->postDataCurl($url,array("cidList"=>$cidList)); } /****恢复频道*****/ public function channel_resume($cid){ $url="https://vcloud.163.com/app/channel/resume"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } /****批量恢复频道****/ public function channel_resumelist($cidList){ $url="https://vcloud.163.com/app/channellist/resume"; return $data=$this->postDataCurl($url,array("cidList"=>$cidList)); } /****获取频道的视频地址*****/ public function channel_videolist($cid){ $url="https://vcloud.163.com/app/videolist"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } } ?>
로그인 후 복사
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사
KB5055523을 수정하는 방법 Windows 11에 설치되지 않습니까?
3 몇 주 전
By DDD
KB5055518을 수정하는 방법 Windows 10에 설치되지 않습니까?
3 몇 주 전
By DDD
<s> : 죽은 레일 - 늑대를 길들이는 방법
1 몇 달 전
By DDD
R.E.P.O.의 모든 적 및 괴물의 강도 수준
1 몇 달 전
By 尊渡假赌尊渡假赌尊渡假赌
<garden> : 정원 재배 - 완전한 돌연변이 가이드
2 몇 주 전
By DDD

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)