msgSecCheck内容安全检查有bug请解决

发布于 7 年前作者 guiying5212000 次浏览最后编辑 7 年前来自 ask

https://developers.weixin.qq.com/minigame/dev/document/open-api/sec-check/msgSecCheck.html


问题一、文档说用GET访问该接口,调用后错误如下

{"errcode":43002,"errmsg":"require POST method hint: [wFaedA05228960]"}


问题二、改用POST方法调用后,无论输入什么内容(等等),都返回通过。

{"errcode":0,"errmsg":"ok"}



AppID: wxd6b53f2145435121


代码片断:

public function check($content)
{
   $access_token = $this->AccessToken();
   $url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='.$access_token;

   $data=array(
       'content' => $content
   );
   $return = $this->request_post($url,json_encode($data));
   return $return;
}
4 回复
yitao
yitao1 楼6 年前

我这样写的一直返回0 是什么原因?

leichao
leichao2 楼6 年前

这个确实,输入啥敏感词都没过滤。。不起作用,,唉。

eluo
eluo3 楼6 年前

已经可行,测试通过。首先确认这个必须用POST


一、使用JSON_UNESCAPED_UNICODE,不对请求的数据进行Unicode编码,结果正常。


$return = $this->request_post($url,json_encode($data, JSON_UNESCAPED_UNICODE));

实测

二、不使用JSON_UNESCAPED_UNICODE,结果是无论什么都返回通过,不起作用。

$return $this->request_post($url,json_encode($data));

实测

思考:不使用Unicode编码可以,可能有其他特殊字符失效风险。

csong
csong4 楼5 年前

测试过了,换成POST