1发送post请求,参数form表单格式
public static String sendFormHttpReq(String url, Map<String, Object> params) throws IOException {
HttpURLConnection conn = null;
OutputStreamWriter out = null;
InputStream inputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader reader = null;
StringBuffer result = new StringBuffer();
try {
conn = (HttpURLConnection) new URL(url).openConnection();
conn.setInstanceFollowRedirects(false);
conn.setReadTimeout(HttpTimeOut);
conn.setConnectTimeout(HttpTimeOut);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("accept", "/");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Accept-Charset", "UTF-8");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
public class HttpClientHandle {
}