SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HttpClient client=new DefaultHttpClient();
HttpPost post=new HttpPost("http://.......");
post.setHeader("Content Type", "application/json");
List<NameValuePair> params= new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("opr", "pwdLogin"));
post.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpres= client.execute(post);
String response = EntityUtils.toString(httpres.getEntity(), "utf-8");
/* ResponseModel model = JSONObject.parseObject(response, ResponseModel.class);*/
System.out.println(sdf.format(new Date())+":"+response);
} catch (Exception e) {
e.printStackTrace();
}
转载于:https://my.oschina.net/u/3267563/blog/1625748