调用例子如下:
/*
* 其中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;
}