lixuesong13
devin_lxs
2017-01-06 07:39

电脑怎么模拟post请求

  • post
  • android

String param = "{\"admin\":\"440000\",\"base\":\"195.6\",\"cross\":\"95\",\"name\":\"广东省\",\"poi\":\"253.4\",\"settle\":\"132\",\"version\":\"161\"}";
HttpURLConnection conn = GetPostUtilToC.getHttpConn(mFileInfo.getUrl());
conn.setConnectTimeout(6000);
conn.setReadTimeout(5000);
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible;MSIE 6.0;Windows NT 5.1; SV1)");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
out = new OutputStreamWriter(conn.getOutputStream());
out.write(param);
out.flush();
int respCode = conn.getResponseCode();
android 端是post之后就会下载文件,电脑怎么模拟?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

6条回答