Currently, I'm doing an application where I need to login to a news website but for some reason I receive a warning and fail to login into the website at the same time.
News website: http://www.malaysiakini.com/
My source code:
private void login(String username, String password){
try {
Connection.Response response = Jsoup.connect("http://www.malaysiakini.com/")
.data("username", "username", "password", "password", "action","//login2.mkini.net/v2/login-exchange")
.method(Connection.Method.GET)
.execute();
String cookie = response.cookie("JSESSIONID");
Document document = Jsoup.connect("http://www.malaysiakini.com/")
.cookie("JSESSIONID", cookie)
.get();
Elements loginData = document.select("logindata");
if(!loginData.isEmpty()){
Log.d("Login Data "," Fail : " + loginData);
}
else
Log.d("Login Data "," Success : " + loginData);
} catch (IOException e) {
e.printStackTrace();
}
}
The warnings:
W/System.err: org.jsoup.HttpStatusException: HTTP error fetching URL. Status=405, URL=http://www.malaysiakini.com/
W/System.err: at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:590)
W/System.err: at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:540)
W/System.err: at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:227)
W/System.err: at com.example.azrie.VoiceTheNews.BackgroundProcessLogin.login(BackgroundProcessLogin.java:60)
W/System.err: at com.example.azrie.VoiceTheNews.BackgroundProcessLogin.doInBackground(BackgroundProcessLogin.java:41)
W/System.err: at com.example.azrie.VoiceTheNews.BackgroundProcessLogin.doInBackground(BackgroundProcessLogin.java:20)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err: at java.lang.Thread.run(Thread.java:841)
Edit
I changed the method from POST to GET and also take a look at the network but still I have no idea what I'm looking for, no idea whether I'm on the right track due to me very new to this. I included some screenshot for viewing.



