I have got a PHP/HTML page where I want to fetch data from but after submitting a form.
Like:
- Open site
- Input this content
- Sumbit
- Parse the NEW site for content
What is the fastest way to achieve this?
I began with webview – too much not needed stuff, so I changed to org.apache.http and that seemed okay.
Here is a part of my code:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("WEBSITE NAME");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("THE NAME OF THE SEARCH B OX", "WORD I WANT TO BE PUT IN"));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
String sourceCode = EntityUtils.toString(httpEntity);
So at the end the httpEntity has got the HTML – and then I’m stuck. Is there any way how to PARSE it to get for example – find a table and get the second row’s second cell’s content?
http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient