Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean login(String email, String pass) throws Exception{
- HttpsURLConnection con = (HttpsURLConnection) new URL("https://www.swagbucks.com/z/0.5352812726557298/?cmd=ac-login-post").openConnection();
- con.setRequestMethod("POST");
- con.setRequestProperty("User-Agent", agents[agentNum]);
- con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- con.setDoOutput(true);
- DataOutputStream wr = new DataOutputStream(con.getOutputStream());
- wr.writeBytes("emailAddress=" + URLEncoder.encode(email ,"UTF-8")+ "&password=" + URLEncoder.encode(pass, "UTF-8") + "&isLoginPage=true&persist=on");
- BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
- String inputLine;
- StringBuffer response = new StringBuffer();
- while ((inputLine = in.readLine()) != null) {
- response.append(inputLine + "\n");
- }
- System.out.println(response);
- in.close();
- return !new String(response).contains("error");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement