Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL obj = new URL("https://account.mojang.com/login");
- HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
- con.setRequestMethod("POST");
- con.setRequestProperty("Host", "account.mojang.com");
- con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- con.setRequestProperty("Content-Length", Integer.toString(postPARAMS.length()));
- //System.out.println(Integer.toString(postPARAMS.length()));
- //con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0");
- //con.setRequestProperty("Connection", "keep-alive");
- //con.setRequestProperty("Accept-Encoding", "gzip, deflate");
- con.setRequestProperty("Accept", "*/*");
- // For POST only - START
- con.setDoOutput(true);
- OutputStream os = con.getOutputStream();
- os.write(postPARAMS.getBytes());
- os.flush();
- os.close();
- // For POST only - END
- System.out.println("POST Response Code :: " + con.getResponseCode());
- final HttpClient client = HttpClientBuilder.create().build();
- final HttpPost loginPost = new HttpPost("https://account.mojang.com/login");
- loginPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36");
- final List<NameValuePair> loginParams = new ArrayList<NameValuePair>();
- loginParams.add(new BasicNameValuePair("username", email));
- loginParams.add(new BasicNameValuePair("password", password));
- loginPost.setEntity(new UrlEncodedFormEntity(loginParams));
- client.execute(loginPost);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement