简单的httpclient post请求
public static void main(String[] args) throws ClientProtocolException, IOException { String str = "http://www.baidu.com"; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(str); try { List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>(); params.add(new BasicNameValuePair("sign", "测试")); post.setEntity(new UrlEncodedFormEntity(params,"UTF-8")); HttpResponse response = client.execute(post); System.out.println(EntityUtils.toString(response.getEntity())); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }