リクエスト本文に設定された1 つのパラメーターを使用して get リクエストを送信していますJSON
が、方法がわかりません。これには特定の方法がありますか?
3 に答える
0
HttpPost post = new HttpPost(url);
post.setHeader("Content-type", "application/json");
InputStream resultStream = null;
HttpResponse response = null;
StringBuilder entityStringBuilder = new StringBuilder();
try {
HttpClient client =new DefaultHttpClient();
JSONObject dateObject = new JSONObject();
dateObject.put("CurrentTime", UTCDate.GetUTCdatetimeAsString());
StringEntity currentDate = new StringEntity(dateObject.toString());
post.setEntity(currentDate);
//post.setEntity(dateObject);
response = client.execute(post);
resultStream = response.getEntity().getContent();
必要に応じて変更してください.......
于 2014-04-28T07:50:09.237 に答える