微信小程序内容安全检测curl


function curl_post_weixin($url,$content){
$curl = curl_init();
$headerArray =array("Content-type:application/json;charset='utf-8'","Accept:application/json");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, 1);
curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($content,JSON_UNESCAPED_UNICODE)); //json格式不被转义加上JSON_UNESCAPED_UNICODE
$response = curl_exec($curl);
curl_close($curl);
$response=json_decode($response);
return $response;
}
检测图片
curl_setopt($curl, CURLOPT_POSTFIELDS, ['media'=>new CURLFILE($content)]); //实例化CURLFILE


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM