跳至 ? ? ? ? ? ? ? ? ? ? [1] ? ? [全屏預(yù)覽]
AppKey = $AppKey; $this->AppSecret = $AppSecret; } /**生成驗(yàn)證碼**/ public function checkSumBuilder(){ //此部分生成隨機(jī)字符串 $hex_digits = self::HEX_DIGITS; $this->Nonce; for($i=0;$iNonce.= $hex_digits[rand(0,15)]; } $this->CurTime = (string)(time()); //當(dāng)前時(shí)間戳,以秒為單位 $join_string = $this->AppSecret.$this->Nonce.$this->CurTime; $this->CheckSum = sha1($join_string); } /*****post請(qǐng)求******/ public function postDataCurl($url,$data=array()){ $this->checkSumBuilder(); //發(fā)送請(qǐng)求前需先生成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 單頁(yè)記錄數(shù),默認(rèn)值為10 否 pnum int 要取第幾頁(yè),默認(rèn)值為1 否 ofield String 排序的域,支持的排序域?yàn)椋篶time(默認(rèn)) 否 sort int 升序還是降序,1升序,0降序,默認(rèn)為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)); } /***** 設(shè)置頻道為錄制狀態(tài) cid String 頻道ID 是 needRecord int 1-開啟錄制; 0-關(guān)閉錄制 是 format int 1-flv; 0-mp4 是 duration int 錄制切片時(shí)長(zhǎng)(分鐘),默認(rèn)120分鐘 否 filename String 錄制后文件名,格式為filename_YYYYMMDD-HHmmssYYYYMMDD-HHmmss, 文件名錄制起始時(shí)間(年月日時(shí)分秒) -錄制結(jié)束時(shí)間(年月日時(shí)分秒) 否 ****/ 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)); } /****恢復(fù)頻道*****/ public function channel_resume($cid){ $url="https://vcloud.163.com/app/channel/resume"; return $data=$this->postDataCurl($url,array("cid"=>$cid)); } /****批量恢復(fù)頻道****/ 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)); } } ?>
本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請(qǐng)聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool
免費(fèi)脫衣圖片

Undresser.AI Undress
人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章
如何修復(fù)KB5060533無法在Windows 10中安裝?
4 週前
By DDD
沙丘:覺醒 - 在哪裡獲得絕緣織物
4 週前
By Jack chen
Gmail登錄:如何註冊(cè),登錄或登錄Gmail -Minitool
1 個(gè)月前
By Jack chen
如何修復(fù)KB5060999無法在Windows 11中安裝?
3 週前
By DDD
污染的公會(huì)指南:阿瓦隆的淪陷
4 週前
By Jack chen

熱工具

記事本++7.3.1
好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強(qiáng)大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6
視覺化網(wǎng)頁(yè)開發(fā)工具

SublimeText3 Mac版
神級(jí)程式碼編輯軟體(SublimeText3)
