日期:2014-05-20 浏览次数:20774 次
HttpPost httpPost=new HttpPost(posturl);
//建立一个NameValuePair数组,用于存储欲传递的参数
List params=new ArrayList();
//添加参数
params.add(new BasicNameValuePair("start", "0"));
params.add(new BasicNameValuePair("size", "14"));
params.add(new BasicNameValuePair("sortType", "hot"));
try {
//设置编码
httpPost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
//发送Post,并返回一个HttpResponse对象
HttpResponse response = client.execute(httpPost);
httpPost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));