First off, I'm pretty newb at this. I'm new to Android, to asp, to javascript, to http even.
I'm trying to build an Android app that allows me to login to my school's website and pull data off it, ultimately I hope to do something like insert my timetable's data into Android's calendar entries. However I'm having trouble logging in.
Here's the website: https://sso.wis.ntu.edu.sg/webexe88/owa/sso_login2.asp
What I'm doing currently is doing a http POST to the above-mentioned URL and I'm hoping to be redirected to hhttps://wish.wis.ntu.edu.sg/pls/webexe/aus_stars_check.check_subject_web2 which will display my timetable.
So far my code is as follows after viewing the webpage's source and searching quite a bit on the Internet:
private void start_login(String[] array) {
// TODO Auto-generated method stub
Toast.makeText(this, "Logging in...", Toast.LENGTH_LONG).show();
WebView wv = new WebView(this);
this.setContentView(wv);
try {
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);
nameValuePairs.add(new BasicNameValuePair("UserName", <my username here>));
nameValuePairs.add(new BasicNameValuePair("PIN", <my password here>));
nameValuePairs.add(new BasicNameValuePair("Domain", "STUDENT"));
nameValuePairs.add(new BasicNameValuePair("p2", "https://wish.wis.ntu.edu.sg/pls/webexe/aus_stars_check.check_subject_web2"));
wv.loadData(CustomHttpClient.executeHttpPost(URL, nameValuePairs), "text/html", "utf-8");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}// end start_login
That's the login function.
The CustomHttpClient I'm using is thanks to this guy: http://www.newtondev.com/2010/07/27/making-http-requests-using-google-android/
So far I'm not getting any results. What am I doing wrong? Am I missing values in the ArrayList, or have I got the URL all wrong?