跳至 ? ? ? ? ? ? ? ? ? ? [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(); //發(fā)送請求前需先生成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 單頁記錄數(shù),默認值為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)); } /***** 設置頻道為錄制狀態(tài) 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)); } } ?>
本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發(fā)現(xiàn)涉嫌抄襲或侵權的內(nèi)容,請聯(lián)絡admin@php.cn

熱AI工具

Undress AI Tool
免費脫衣圖片

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

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

Clothoff.io
AI脫衣器

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

熱門文章
指南:恆星刀片保存文件位置/保存文件丟失/不保存
4 週前
By DDD
Agnes Tachyon Build Guide |漂亮的德比志
2 週前
By Jack chen
Oguri Cap Build Guide |漂亮的德比志
2 週前
By Jack chen
沙丘:覺醒 - 高級行星學家Quest演練
4 週前
By Jack chen
約會一切:德克和哈珀關係指南
4 週前
By Jack chen

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

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

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

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

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