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"}"
请问这个问题如何解决呢? 是哪里没写对吗?
如果方便,希望能把代码贴出来,非常感谢