public String download(String urlStr){
String myString = null;
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(urlStr); ResponseHandler<String> responseHandler = new BasicResponseHandler();
try{
myString = httpclient.execute(httpget, responseHandler);
}catch(Exception e){
myString = e.getMessage();
}
httpclient.getConnectionManager().shutdown();
return myString;
}String str = download("http://a.soon.com/...");
返回str不是正确内容竟是: a.soon.com后来用了URLConnection方式试了一下,还是返回: a.soon.com如果用内置浏览器却可以返回正确内容。请问何因,是接入点不正确所致吗?
String myString = null;
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(urlStr); ResponseHandler<String> responseHandler = new BasicResponseHandler();
try{
myString = httpclient.execute(httpget, responseHandler);
}catch(Exception e){
myString = e.getMessage();
}
httpclient.getConnectionManager().shutdown();
return myString;
}String str = download("http://a.soon.com/...");
返回str不是正确内容竟是: a.soon.com后来用了URLConnection方式试了一下,还是返回: a.soon.com如果用内置浏览器却可以返回正确内容。请问何因,是接入点不正确所致吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货