抖音小程序,文本输入内容检测

function curlRequest($url,$mothed, $contentbody,$access_token)
{
$ch = curl_init();
$header = "Accept-Charset: utf-8";
$header = "Content-Type:application/json"; 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Token: '.$access_token.''));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $mothed);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $contentbody);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$temp = curl_exec($ch);
curl_close($ch);
return $temp;
}
 
 
 
        $contentbody = '{"tasks": [{"content": "'.$content.'"}]}';
        $url = "https://developer.toutiao.com/api/v2/tags/text/antidirt"; 
        $respon = curlRequest($url,'POST',$contentbody,$access_token);
        $respons = json_decode($respon,true);

猜你喜欢

转载自www.cnblogs.com/pansidong/p/13390262.html