弱弱地问一下,可以通过java应用程序直接使用google map api么?不通过浏览器
弱弱地问一下,请问可以通过java应用程序直接使用google map api么?不通过浏览器访问 --------------------编程问答-------------------- http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_java.html --------------------编程问答--------------------谢谢楼上的链接啊! 英语看得我头大啊,能稍微解释一下么?是如何不用通过浏览器就可以访问google web 服务的呢? --------------------编程问答-------------------- 可以 通过HttpClient 后台发起请求,给你段代码参考
--------------------编程问答--------------------
/**
* @param requestURL 要请求的地址
* @return
* @throws Exception
*/
private static String getHtml(String requestURL) throws Exception{
URL url=new URL(requestURL);
HttpClient client=new HttpClient();
HttpHost host=new HttpHost("localhost");
client.getHostConfiguration().setHost(host);
// HttpClientParams params=new HttpClientParams();
GetMethod method=new GetMethod(url.toString());
client.executeMethod(method);
//获取响应的html
return method.getResponseBodyAsString();
}
一楼给的地址右上角有语言选项,选中文简体就可以了
google都给封装好了,不需要HttpClient了
补充:Java , Web 开发