Java使用httpclient发送post请求

 public static String sendJsonPost(String url,String[] keys,Object[] values)throws Exception{
        HttpPost httpPost=null;
        CloseableHttpClient client=null;
        JSONObject jsonParam=null;
        String responseContent=null;

        try{
            httpPost= new HttpPost(url);
            client = HttpClients.createDefault();
            jsonParam= new JSONObject();
//            jsonParam.put("username","ZMDC");
//            jsonParam.put("sms","1440396636364");
//            jsonParam.put("sign","48cd217b452cc1df");
            if(keys.length>0&&values.length>0&&keys.length==values.length) {
                for(int i=0;i

你可能感兴趣的:(学习资料,日常问题)