I want to login to https://spps.getalma.com
Below is the form source
<form id="login-form" action="/login" method="post" autocomplete="off" class="pure-form pure-form-stacked login-form">
<label>
Username
<input name="username" type="text" class="pure-input-1" placeholder="Username" value="" required="" autofocus="">
</label>
<label>
Password
<input name="password" type="password" class="pure-input-1" placeholder="Password" value="" required="">
</label>
<button type="submit" class="pure-button pure-button-primary">Login</button>
</form>
I am trying this
public String getString(String username, String password) {
Connection.Response loginForm = null;
Document document = null;
try {
loginForm = Jsoup.connect("https://spps.getalma.com/").method(Connection.Method.GET).execute();
document = Jsoup.connect("https://spps.getalma.com/login")
.data("cookieexists", "false").data("username", username)
.data("password", password).cookies(loginForm.cookies()).post();
} catch (IOException e) {
e.printStackTrace();
}
String temp = document.title();
return temp;
}
But when I start the app and execute this method, my app just shuts down. I am guessing that it doesn't login properly and I don't know what I should do to make it work..
You can use this username and password to login
ID: paul.kim
Password: Dvjpp;[sddeptfdr,rdyrt1
It says this is Caused by: android.os.NetworkOnMainThreadException
Please help me. Thanks