This works for me:
final URL url = new URL("https://mtgox.com/code/getFunds.php");
final HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
urlConn.setRequestMethod("POST");
final DataOutputStream printout = new DataOutputStream(urlConn.getOutputStream());
final String content = "name=" + URLEncoder.encode(USERNAME, "UTF-8") + "&pass=" + URLEncoder.encode(PASSWORD, "UTF-8");
printout.writeBytes(content);
printout.flush();
printout.close();
Did you forget to URLEncode your username and password? Or is the typo where you set the "Content-Type" to
"application/x-www- form-urlencoded"
really there?