0

I'm using jsoup for getting information from different API and parsing it. Functional compounds enough for all occasions, as long as I did not need to implement something in the likeness of the following code..

URL obj = new URL(url);
javax.net.ssl.HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();

String postParams = new StringBuffer("{\"method\": \"getAccountInfo\",
\"params\": [], \"id\": 1}");
conn.setDoOutput(true);

// Send post request
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(postParams.toString());
wr.flush();
wr.close();

I spent a lot of searching and re-read all the available documentation, but have not found a method to insert in the post parameters JSONArray as in the example.

Maybe I'm missing something, I will be very grateful for the help, how to implement the code using org.jsoup.HttpConnection.

BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
DmRomantsov
  • 313
  • 2
  • 8
  • 1
    Maybe it can help you http://stackoverflow.com/questions/10012399/how-to-post-data-into-website-using-jsoup – Danilo Gomes Mar 04 '15 at 17:18
  • Unfortunately, it isn't help. I'm understand how send parameters. The problem is jsoup.HttpConnection don't provide sending info in or format. Or getting outputStream of connection. – DmRomantsov Mar 05 '15 at 11:08
  • Sounds like you would rather want to use a REST client like Jersey instead of Jsoup, which is meant for HTML stuff. Besides that, here is a related question: http://stackoverflow.com/questions/24871625/how-to-send-data-in-jsoup-connection – korpe Mar 10 '15 at 11:52

0 Answers0