微信智能小机器人 小马 智能客服 调用

来源:互联网 发布:大学毕业证制作软件 编辑:程序博客网 时间:2024/05/04 17:35

调用例子如下:

/*
* 其中KEY 为验证码  可以填写为123 content为内容  编码为UTF-8
*/

public static String chatting(String key,String content) throws UnsupportedEncodingException{

String eString=URLEncoder.encode(content,"UTF-8");
//System.out.println(eString);
String u="http://laoyao001.gotoip1.com/xiaoma/chat.action?key="+key+"&content="+eString;
HttpClient client=new HttpClient();
GetMethod get=new GetMethod(u);
String str="";
try {
client.executeMethod(get);
str=new String(get.getResponseBodyAsString().getBytes("iso-8859-1"),"UTF-8");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return str;

}
0 0
原创粉丝点击