0

Is it possible to send the content of a textbox in an android application to the textbox of a website?...

Example:

I have IDNo and Pass as textbox in my application. There is also a log.in button.

If i press the login button, the content of IDNo and Pass will be sent to the appropriate textbox in the website (students.usls.edu.ph) and log.in...

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by pmark019
1

Simple example of post request. You need to check what are the names of the fields for credentials as not everyone stick with username and password

public void postData() {
    // Create a new HttpClient and Post Header
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://www.daniweb.com");

    try {
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("username", "pmark019"));
        nameValuePairs.add(new BasicNameValuePair("password", "My password"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);

    } catch (ClientProtocolException e) {
        Log.e("ClassName", e);
    } catch (IOException e) {
        Log.e("ClassName", e);
    }
} 
0

Thanks for this but how will I know that I was successfully able to log-in to the website?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.