敏感图片检测接口
调用敏感图片检测接口
https://api.weixin.qq.com/wxa/img_sec_check?access_token=
总是返回
{“errcode”:41005,“errmsg”:“media data missing hint: [yccPpa00088***]”}
参数:@C:\phpStudy\WWW\test\upload_cut_tempimg\15246560060977.jpg
10 回复
我也遇到这个问题了,不过经过不断尝试解决了,特来分享一下
php版本:7.1.1
function img_check( $img_path ){ $access_token = get_user_access_token(); $url = 'https://api.weixin.qq.com/wxa/img_sec_check?access_token=' . $access_token ; $post_data = [ 'media' => new CURLFile( $_SERVER [ 'DOCUMENT_ROOT' ]. $img_path ) ]; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, $url ); curl_setopt( $ch , CURLOPT_RETURNTRANSFER, 1); curl_setopt( $ch , CURLOPT_HEADER, 0); curl_setopt( $ch , CURLOPT_POST, 1); curl_setopt( $ch , CURLOPT_BINARYTRANSFER, true); curl_setopt( $ch , CURLOPT_TIMEOUT, 100); curl_setopt( $ch , CURLOPT_POSTFIELDS, $post_data ); $output = curl_exec( $ch ); curl_close( $ch ); return $output ; } |
{“errcode”:87014,“errmsg”:“risky content hint: [1J7CIa04481548]”}传了一张非法图片,返回:
传正常的图片,返回:
{“errcode”:0,“errmsg”:“ok”}