public void static main(String [] args) { String url = "http://baidu.com"; HttpClient client = new HttpClient(); GetMethod get = new GetMethod(url); get.addRequestHeader("Accept-Encoding", "gzip"); get.addRequestHeader("params1", "参数1"); get.addRequestHeader("params2", "参数2"); get.addRequestHeader("params3", "参数3"); get.addRequestHeader("params4", "参数4"); try { int statuscode = client.executeMethod(get); Integer status = Integer.valueOf(get.getStatusCode()); System.out.println(statuscode); System.out.println(status); String response = get.getResponseBodyAsString(); System.out.println(response);// HashMap map = new HashMap(); rtn.put("status", status); rtn.put("response", JSON.parseObject(response).getString("data")); } catch (Exception e) { e.printStackTrace(); return false; } //return rtn; }