http://api.polyv.net/live/v3/channel/common/get-token
1、接口用于获取授权和连麦的token
2、接口支持https
{
"code": 200,
"status": "success",
"message": "",
"data": {
"mediaChannelKey": "e2355436235ba12d4c56493b575afed38f9f061d044f54d93c30f01463ffea852a7119c6195c6abf51b4682bc596bf5962eddc6cbf82784a1e5309ac52220ef7e66e4e7eb69a4e80081056972d5a9cb3bb723a0cb090702eef99369d479482b3bad99e5ec50eae5607b82c58da59aac3eada29fe6d753ef358d064ee308e406b3091f5256a77251001f99b6815651f18982da983b58c79d9caedd5ccec3f20ecd3dde7ba370f3c0ca0aa8c3ef088148523019f06e224d030b871da390c4a1a1c646e26684895d544dbba47751c535d07ea765fcf0cdfe8fe3de1538e4fe69eecadfd4a8b431aa4b00bc5dbccdb996ea3b7f962da2ecc21b6b14ba70c33601c53c3aa8d8e4857c111fa076e47e3a6eafc9601b87c079361f2d0f3cb4b31df2ff088ccb9428abe324ecb9e07e2fb8f48e40ab2ef3e119cfd93b15259bfa390938485a8fcd2e200dadeefe15a0516b7f61736cbe5bf48564d100e28ff64f979ebf42eadd3a0f3d58565d1ab619884d78c29",
"token": "71b961e6b2a68cde9559966b2f46d4e0"
}
}
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": 400
}
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'channelId' => 195770
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "http://api.polyv.net/live/v3/channel/common/get-token?".http_build_query($params);
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>