<?php
$userid="9f1e0689e1";//必选
$channelId=100000;
$ptime=time()*1000;//必选
$sessionId="xxxfjkddk9";
$vid="b0f7041324572aa5df1e91a971d3ec15_b"
$secretkey="secretkey";
$post_data = array (
"channelId" => $channelId,
"ptime" => $ptime,
"vid" => $vid,
"sessionId" => $sessionId
);
$str="";
foreach ($post_data as $key => $value){
if (!empty($value)) {
$str.=$key."=".$value."&";
}else{
unset($post_data[$key]);
}
}
$str=substr($str, 0,strlen($str)-1);
$str.=$secretkey;
// echo $str;
// die();
$hash=strtoupper(sha1($str));
$post_data["sign"] = $hash;
// var_dump($post_data);
// exit();
$url="http://api.polyv.net/v2/video/{$userid}/get-live-playback";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>