Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String postData = String.format("username=%s&password=%s",
- URLEncoder.encode(username, "UTF-8"),
- URLEncoder.encode(password, "UTF-8"));
- URL url = new URL("http://example.com/login.php");
- HttpURLConnection connection =
- (HttpURLConnection) url.openConnection(createTorProxy());
- connection.setRequestMethod("POST");
- connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- connection.setRequestProperty("Content-Length", String.valueOf(postData.length()));
- connection.setDoOutput(true);
- OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
- writer.write(postData);
- writer.flush();
- writer.close();
- Log.d(TAG, String.format("Login result: %d", connection.getResponseCode()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement