http://api.polyv.net/live/v3/channel/bookings-and-likes
1.获取多个频道号预约数与点赞数
2.接口支持https
签名错误:
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
时间戳错误:
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
appId错误
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
应用找不到
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
频道号错误
{
"code": 400,
"status": "error",
"message": "channelIds is required.",
"data": ""
}
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"channelId": 2271296,
"bookings": 1,
"likes": 0
},
{
"channelId": 2271286,
"bookings": 0,
"likes": 0
},
{
"channelId": 2075015,
"bookings": 0,
"likes": 81
}
]
}
<?php
//引用config.php
include 'config.php';
$channelIds = "322120,2029098";
$params = array(
'appId'=>$appId,
'channelIds'=>$channelIds,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;
$url="http://api.polyv.net/live/v3/channel/bookings-and-likes?".http_build_query($params);
$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;
?>