$accessToken = $this->getAccessToken(); $url = "https://api.weixin.qq.com/wxa/img_sec_check?access_token={$accessToken}"; $curl = curl_init(); if (class_exists('\CURLFile')) { curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true); $data = array('media' => new \CURLFile($imgUrl));// } else { curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false); $data = array('media' => '@' . $imgUrl); } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_USERAGENT, "TEST"); $result = curl_exec($curl); if ($result === false) { echo "error:" . curl_errno($curl); exit; } dd($result); 一直返回空 ""
php调用security.imgSecCheck图片检测,很黄的图片都能通过怎么回事呢?一直返回的是OK 不管在黄的图片都OK
2021-08-23一直返回空呀
PHP调用内容安全接口imgSecCheck图片校验,一直报"errcode":47001怎么解决?接口地址: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.imgSecCheck.html 开发环境: PHP7.1 + Nginx + 宝塔面板 (尝试了百度的各种办法,都是出现一样的问题 47001错误) 以下是百度找的代码 不知道哪里有问题 就是不可以 $token = (new Dynamic)->getAccessToken(); $url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='.$token; $path = '/www/wwwroot/Forum/public/uploads/20200503/61b05148d3d8b83ea47602056cb44c85.png'; $data = new \CURLFile(realpath($path)); $data->setMimeType("image/png"); $postdata['media'] = $data; $curl = curl_init(); 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, TRUE); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($curl); curl_close($curl); dump($output); 请求返回的错误: "{"errcode":47001,"errmsg":"data format error hint: [ZGkDJlnre-eQn1.a] rid: 5f3f6f27-1779411b-5cdb3907"}" 请问这个问题如何解决呢? 是哪里没写对吗? 如果方便,希望能把代码贴出来,非常感谢
2021-08-23