http://api.live.polyv.net/v2/statistics/{channelId}/summary
通过频道号(channelId)获取该频道某段时间的直播统计数据。
{
status: "success",
result: [
{
currentDay: "2017-08-02",
channelId: 101378,
userId: "edv3kno3t5",
pcPlayDuration: 18,
pcFlowSize: 7533133,
pcVideoView: 3,
pcUniqueViewer: 1,
mobilePlayDuration: 10,
mobileFlowSize: 0,
mobileVideoView: 6,
mobileUniqueViewer: 2,
createdTime: 1501697384000,
lastModified: 1501697384000
}, {
currentDay: "2017-08-03",
channelId: 101378,
userId: "edv3kno3t5",
pcPlayDuration: 34,
pcFlowSize: 23014636,
pcVideoView: 10,
pcUniqueViewer: 1,
mobilePlayDuration: 16,
mobileFlowSize: 0,
mobileVideoView: 5,
mobileUniqueViewer: 2,
createdTime: 1501783204000,
lastModified: 1501783204000
}, {
currentDay: "2017-08-04",
channelId: 101378,
userId: "edv3kno3t5",
pcPlayDuration: 3,
pcFlowSize: 0,
pcVideoView: 1,
pcUniqueViewer: 1,
mobilePlayDuration: 0,
mobileFlowSize: 0,
mobileVideoView: 0,
mobileUniqueViewer: 0,
createdTime: 1501816874000,
lastModified: 1501816874000
}
]}
{
code: "invalid.request",
msg: "signature error."
}
<?php
header("Content-type: textml; charset=utf-8");
$startDay="2017-08-02";
$endDay="2017-08-08";
$appId="egzhqa99ud";
$timestamp= time()*1000;
$appSecret = "60a0563af8c141e3b2c5b91429fbbc66";
$str=$appSecret."appId".$appId."endDay".$endDay."startDay".$startDay."timestamp".$timestamp.$appSecret;
$sign = md5($str);
$sign = strtoupper($sign);
$url = "http://api.live.polyv.net/v2/statistics/101378/summary?timestamp=$timestamp&sign=$sign&endDay=$endDay&startDay=$startDay&appId=$appId";
$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;
?>
ptime = "1501055103000"
startDay="2017-08-02"
endDay="2017-08-08"
appId="egzhqa99ud"
2、连接字符串 连接参数名与参数值,并在首尾加上secretkey(此处secretkey的值为60a0563af8c141e3b2c5b91429fbbc66),如下:
"60a0563af8c141e3b2c5b91429fbbc66" + "appId" +
"egzhqa99ud" + "endDay" + "2017-08-08" + "ptime" +
"1501055103000" + "startDay" + "2017-08-02" + "60a0563af8c141e3b2c5b91429fbbc66"
C758DF8045929D51CA28D51B934C9AAC