URL url=new URL("http://www.baidu.com");
connection =(HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
InputStream in =connection.getInputStream();
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet("http://www.baidu.com");
HttpResponse response =client.execute(get);
HttpEntity entity =response.getEntity();
InputStream in = entity.getContent();
真机测试HttpURLConnection获取不到数据 用HttpClinet又可以 5.0系统
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- threenewbee 2016-10-24 02:38关注
看看是不是dns解析的问题,是随机出现的么,返回什么错误
http://blog.csdn.net/hguang_zjh/article/details/33743249解决 无用评论 打赏 举报