I have not yet tried POST on Mt Gox. Because their websocket API is non-responsive, I have been polling their published ticker API ...
final String httpsURLString = "https://mtgox.com/code/data/ticker.php";
final StringBuilder stringBuilder = new StringBuilder();
try {
final URL url = new URL(httpsURLString);
final HttpsURLConnection httpURLConnection = (HttpsURLConnection) url.openConnection();
final InputStream inputStream = httpURLConnection.getInputStream();
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String inputLine;
while ((inputLine = bufferedReader.readLine()) != null) {
stringBuilder.append(inputLine);
stringBuilder.append(' ');
}
bufferedReader.close();
} catch (IOException ex) {
// report exception
}
final JSONObject jsonObject1 = (JSONObject) JSONValue.parse(stringBuilder.toString());
final JSONObject jsonObject2 = (JSONObject) jsonObject1.get("ticker");
final BigDecimal bidPrice = new BigDecimal(jsonObject2.get("buy").toString());
final BigDecimal askPrice = new BigDecimal(jsonObject2.get("sell").toString());
final BigDecimal lastPrice = new BigDecimal(jsonObject2.get("last").toString());
final BigDecimal highPrice = new BigDecimal(jsonObject2.get("high").toString());
final BigDecimal lowPrice = new BigDecimal(jsonObject2.get("low").toString());
final BigDecimal volume = new BigDecimal(jsonObject2.get("vol").toString());
The json-simple1.1.jar is a dependency. I used keytool to import the Mt Gox SSL certificates from my web browser into cacerts, as I previously deleted all X509 certificates from that keystore as a security precaution.