String url = "http://www.login";//例子
HttpPost httpPost = new HttpPost(url);//将url放入post
//HttpPost或者HttpPut请求需要在请求里加参数,而HttpGet或者HttpDelete请求则可以直接拼接到url字符串后面
//向HttpPost中加入参数。
List<NameValuePair> values = new ArrayList<NameValuePair>();
values.add(new NameValuePair("name", "22"));
values.add(new NameValuePair("pwd", "22"));
httpPost.setEntity(new UrlEncodeFormEntity(values, HTTP.UTF_8)); //先转码
HttpGet方式:
url = url + "?name=22&pwd=22";