java通过http协议模拟post提交
代码: URL url=new URL("");
OutputStreamWriter outStrm =null;
URLConnection rulConnection = url.openConnection(); HttpURLConnection httpUrlConnection = (HttpURLConnection) rulConnection; httpUrlConnection.setDoOutput(true); httpUrlConnection.setDoInput(true); httpUrlConnection.setUseCaches(false); httpUrlConnection.setRequestMethod("POST"); httpUrlConnection.setRequestProperty("accept", "*/*");outStrm= new OutputStreamWriter(httpUrlConnection
.getOutputStream()); //提交数据 outStrm.flush(); outStrm.write(param); outStrm.close(); InputStream inStrm = httpUrlConnection.getInputStream();//从服务器返回的数据BufferedReader br = new BufferedReader(new InputStreamReader(inStrm,"UTF-8"));