Letv cloud API, api

Source: Internet
Author: User

Letv cloud API, api

Upload the video to letv cloud and play it on your website.

I personally understand that Leeco cloud acts as a resource server here to get video links and information from the api and store it in its own library and associate it with the project. The following code is found from a deregistered open-source Chinese friend.

1 2/* 3 * function: generate a signature 4 */5 protected function _ getSign ($ param) 6 {7 // signature Step 1: 8 ksort ($ param); 9 10 $ String = $ this-> _ formatBizQueryParaMap ($ param); // concatenate an array 11 12 // signature Step 2: add KEY13 $ string = $ String. $ this-> secret; 14 15 // signature Step 3: MD5 encryption 16 $ String = md5 ($ String); 17 18 return $ String; 19} 20 21/* 22 * Spliced array 23 */24 protected function _ formatBizQueryParaMap ($ paraMap, $ urlencode = '') {25 $ buff = ""; 26 ksort ($ paraMap); 27 foreach ($ paraMap as $ k = >$ v) {28 if ($ urlencode) {29 $ v = urlencode ($ v ); 30} 31 $ buff. = $ k. $ v; 32} 33 return $ buff; 34} 35 36/* 37 * Send curl request 38 */39 public function _ curlPost ($ url, $ data) {40 41 $ ch = curl_init (); 42 $ header [] = "Accept-Charset: UTF-8"; 43 curl_setopt ($ ch, CURLOPT_URL, $ url ); 44 curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, "POST"); 45 curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, FALSE); 46 curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, FALSE ); 47 curl_setopt ($ ch, expires, $ header); 48 curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1); 49 curl_setopt ($ ch, CURLOPT_AUTOREFERER, 1); 50 curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data); 51 curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true); 52 $ tmpInfo = curl_exec ($ ch); 53 curl_close ($ ch); 54 55 return $ tmpInfo; 56} 57 58}

The key user id uuid is an md5-encrypted sign that can be seen in the Leeco cloud background through an algorithm and its own secret.

1 <? Php 2 3 require_once 'getsign. php'; 4 $ LeshiController = new LeshiController (); 5 $ result = $ LeshiController-> dianbo ('video. list '); 6 var_dump ($ result); 7/** result 8 array 9 0 => 10 array11 'video _ id' => string '123' (length = 8) 12 'video _ unique' => string '810090111f' (length = 10) 13 'video _ name' => string 'yin and Yang Shi '(length = 9) 14 'img '=> string 'HTTP: // timeout (length = 114) 15 'init _ pic' => string ''(length = 0) 16 'is _ pay' => string '0' (length = 1) 17 'video _ duration' => string '123' (length = 3) 18 'initial _ size' => string '20170' (length = 8) 19 'error _ Code' => string '0' (length = 1) 20 'error _ desc' => string ''(length = 0) 21 'complete _ time' => string '2017-10-28 09:36:46 '(length = 19) 22 'add _ time' => string '2017-10-28 09:35:38 '(length = 19) 23 'isdrm' => string '0' (length = 1) 24 'isdownload' => string '0' (length = 1) 25'video _ desc' => string ''(length = 0) 26 'tag' => string' '(length = 0) 27 'file _ md5' => string '547428c7a1e48587f36c5d0969d35565' (length = 32) 28 'mid '=> string '200' (length = 9) 29 'usercategory1' => string '200' (length = 5) 30 'usercategory2' => string '123' (length = 5) 31 'status' => string '10' (length = 2) 32 */

It is easy to get the video list without parameters. If you need to get other information, pass the corresponding value according to the method.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.