Httplient 获取网络数据
2014-05-15 22:55
106 查看
get: HttpClient http = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
HttpResponse response = http.execute(httpGet);
InputStream in = response.getEntity().getContent();
post: HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
// 设置参数
List params = new ArrayList();
BasicNameValuePair val = new BasicNameValuePair("selected", String.valueOf(1));
params.add(val);
post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
HttpResponse response = client.execute(post);
HttpEntity entity = response.getEntity();
InputStream in = entity.getContent();
HttpGet httpGet = new HttpGet(url);
HttpResponse response = http.execute(httpGet);
InputStream in = response.getEntity().getContent();
post: HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
// 设置参数
List params = new ArrayList();
BasicNameValuePair val = new BasicNameValuePair("selected", String.valueOf(1));
params.add(val);
post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
HttpResponse response = client.execute(post);
HttpEntity entity = response.getEntity();
InputStream in = entity.getContent();
相关文章推荐
- 网络数据获取及查询系统目标
- 在vb中使用Iphlpapi.dll获取网络信息 第四章 第三节 实例一:网络数据流量图
- 获取网络数据
- BitmapFactory类的decodeStream方法在网络超时或较慢的时候无法获取完整的数据
- 不直接使用NSData的dataWithContentsOfURL来获取网络数据
- 在vb中使用Iphlpapi.dll获取网络信息 第四章 第三节 实例一:网络数据流量图
- iPhone-获取网络数据或者路径的文件名以及后缀
- android_学习—获取网络数据(图片,html)
- android开发之获取网络数据
- 在WP7中显示员工xml数据(从网络获取数据) 转
- iPhone-获取网络数据或者路径的文件名
- java.net.*获取网络数据
- flex webservice 获取数据网络资源
- 获取网络数据
- 从网络上获取数据
- 迭代网络数据头信息 以及获取客户端真实IP
- Flex HTTPService 获取数据网络xml资源
- Android之从网络中获取数据并返回客户端的两种方式:XML格式返回与Json格式返回
- Android成长之路-获取网络数据(图片)
- 【android初级】之Android之从网络上获取数据(图片,网页,xml,json等)