http://api.polyv.net/live/v2/chat/{channelId}/cleanChat
1、接口用于删除频道所有聊天记录
2、接口URL中的{channelId}为 频道ID
3、接口支持https
{
"code": 200,
"status": "success",
"message": "",
"data": true
}
{
"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": ""
}
{
"code": 500,
"status": "fail",
"message": "api error.",
"data": ""
}
<?php
//引用config.php
include 'config.php';
$channelId="123713";
$params = array(
'appId' => $appId,
'timestamp' => $timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$url="http://api.polyv.net/live/v2/chat/".$channelId."/cleanChat";
function post($url, $post_data = '', $timeout = 5){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
$params["sign"] = $sign;
echo post($url, $params);
?>