已解决,百度之后换了一种Post调用: https://zhidao.baidu.com/question/687447786330732684.html
java调用msgSecCheck接口使用测试字符串测试,测试无效- 当前 Bug 的表现(可附上截图) [图片] - 预期表现 {"errcode":87014,"errmsg":"内容含有违法违规内容"} - 复现路径 - 提供一个最简复现 Demo jar包: [图片] public static void main(String[] args) { CloseableHttpClient client = HttpClients.createDefault(); String url = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=22_to3mpu9eWGdL6NGXvFiRHHnq9hXfwwwgUbDZNFmtZBhNIo9WeUsH8K7bkjQOAGvaUx1WD-ZWDETwb6NYxWsS00DH8kk8iVHlq1YijPHSSPK5at4kOP1YIcx7nC0MBYeAJAETQ"; HttpPost httpPost = new HttpPost(url); httpPost.setHeader("Content-Type", "application/json;charset=UTF-8"); Map<String, String> params = new HashMap<>(); params.put("content", "完2347全dfji试3726测asad感3847知qwez到"); String parameter = JSON.toJSONString(params); StringEntity se; String result = null; CloseableHttpResponse response; HttpEntity entity; try { se = new StringEntity(parameter); se.setContentType("text/json"); httpPost.setEntity(se); response = client.execute(httpPost); entity = response.getEntity(); result = EntityUtils.toString(entity, "UTF-8"); System.out.println(result); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
2019-06-27