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...

Recommended Answers

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 …
Jump to Post

All 2 Replies

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);
    }
} 

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.