0
當有公佈的參數, 我們這樣做空的JSON對象POSTING
JSONObject postParams = new JSONObject("{ \"ccc\": \"20000\", \"abc\": \"21000\""}
「);
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(postParams.toString());
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
System.out.println("\nSending 'POST' request to URL : " + url);
System.out.println("Post parameters : " + postParams);
System.out.println("Response Code : " + responseCode);
如果心不是任何參數,我試圖做
JSONObject postParams = new JSONObject("{}");
它失敗了但是唯一的ID包含在鏈接裏面
https://domain.com/ut/game/game/trade/{UNIQUE ID HERE}/bid
有一些我錯過了我相信。
爲什麼不只是'new JSONObject();'? –
我想你錯過了問題部分... – BTC
「It failed」 - 這是什麼意思?你有錯誤嗎? – Quentin