String encode = "湖南省常德市鼎城区";

encode = URLEncoder.encode(address, "UTF-8");//将地址转换成utf-8的16进制
String key1 = "fc9dbd184cd52c9855fcec1ef1bffb7c";
// String key2 = "7d9fbeb43e975cd1e9477a7e5d5e192a";
// String key3 = "8ec6cd98bd56554407a207d597c0f3e5";
// String key4 = "be025dc280e1e3f7ffb95fe42a01fab2";
// String key5 = "327db7009617d6806b9c38e819ea06ac";
// String key6 = "1583bbc58f1606ccc52d28bffacf0914";
// String key7 = "141f40110b3f79806843ec462ff68382";
// String key8 = "6e76d75a1a494478345c05c762961712";
// String key9 = "346b76a66bfa282199807a41ec2d971c";
 
一个KEY ,一天只能请求一千次
try {
//如果有代理,要设置代理,没代理可注释
System.setProperty("http.proxyHost","192.168.1.188");
System.setProperty("http.proxyPort","3128");
URL tirc = new URL(" ="+ encode +"&output=xml&key="+ key1);
BufferedReader in = new BufferedReader(new InputStreamReader(tirc.openStream()));
String s;
while((s = in.readLine())!=null){
sb.append(s+"\r\n");
System.out.println(s);
}
in.close();
}catch(UnknownHostException e){
e.printStackTrace();
}catch (MalformedURLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
str = sb.toString();