你调用接口都不监视接口返回的数据么,你这样调用接口会直接返回错误提示
touser就写一个openID 用for循环处理,脑壳别太死板了
public static void sendall(List openids, String msg){
for (int i = 0; i
sendWxMessage(openids.get(i),msg);
}
}
public static void sendWxMessage(String open_id, String msg) {
// 调用微信接口
String respMessage = "{\"touser\":\"" + open_id + "\",\"msgtype\":\"text\",\"text\":{\"content\":\"" + msg
+ "\"}}";
HttpsURLConnection urlCon = null;
byte[] bf = bf = respMessage.getBytes("UTF-8");
urlCon = (HttpsURLConnection) (new URL(GlobalFunction.sendurl + GlobalFunction.access_token)) //调用接口和access_token
.openConnection();
urlCon.setDoOutput(true);
urlCon.setRequestMethod("POST");
urlCon.setRequestProperty("Content-Length", bf.length + "");
urlCon.setUseCaches(false);
urlCon.setDoInput(true);
urlCon.getOutputStream().write(bf);
urlCon.getOutputStream().flush();
urlCon.getOutputStream().close();
BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()));
}字数限制 异常什么的 自行处理