views:

35

answers:

1

How would you fill in a form on a webpage (not under my control) in an Android program?

I want to write a little android program to automate interacting with a website that someone else has written and I can't change. It has no published API. So the process is:

  1. Fetch the web page with a form on it (eg a login page)
  2. Parse it (eg find the username, password box on the page)
  3. Do some processing (eg fetch a username and password from a database)
  4. Submit the form back and get the result (eg simulate the user hitting login)
  5. Repeat ...

It is step 4 I'd like the help with. If I wasn't using Android I'd use a library library like libcurl (for python) or apache httpclient (for normal java), or I'd do some DOM interaction with a webbrowser. What would you recommend doing for android? Is there something built into the standard libraries you'd recommend?

I'm a pretty experienced Java programmer but all I've written in Android is hello world, if that affects your answer.

+1  A: 

Apache httpclient is built into the standard Android libraries. Use the normal code there - HttpGet and HttpPost

This will also be able to help with step 1 as well.

Doh, should have googled for a bit longer before resorting to Stack Overflow.

Nick Fortescue