Question: My question maybe unheard of or may even be impractical.
But, I believe it is practical and acceptable.

**Problem: PHP request and response in background thread.**

Problem constraints:

1. You know it uses POST method.
2. It has two fields fname and lname as html ids that need to be filled.
3. You get response in the same page i.e. index.php .

Pseudocode to solve the problem:

1. Open the website in background. Something like openURL("xyz(dot)com");
2. Read the data sent in html format.
3. Change the value of the fields fname and lname to required fields "Allen" and "Walker."
4. Now, submit the fields back to the server. ( Page has a submit button.)

**Note:** PHP code has a standard if-else check to check for those values. If the field is properly set, it then says "Success" else "Failed"

5. Again, get the response sent by the server.
6. Check if "Success" was returned.
7. If "success" was returned, UPDATE UI thread for saying "JOB done".
Else, "Job failed."

**Note: I am not talking about using a** *WebView*. **Everything happens via a service or AsyncTask**.

---

Now, this is a simple question, and any ideas or a direction is acceptable.

**So, to recap. You have to open a webpage in background, change its field, submit it back and then get the response.**

---

I know we can open a website and get its content. But, I would also like to know if what I said is possible or not. And, I know it is possible. And, that I only lack the knowledge on Java Web API, could you please guide me on this.

Thank You. And, Have a Good day!

Answer: 
use [this link](http://www.androidhive.info/2012/01/android-json-parsing-tutorial/) for best solution of calling web service without using WebView.

In this example fname and lname sent in namevaluepairs we get responce in json formet and parse json and get data also json parse defined in examples.
What you are trying to achieve is to create a webservice call using a [AsyncTask](http://developer.android.com/reference/android/os/AsyncTask.html).

Like you have mentioned, you can make a post request within the AsyncTask, passing in the variables required for the request. 

You can find a good example as shown: [Sending HTTP Post Request with Android](https://stackoverflow.com/questions/31552242/sending-http-post-request-with-android)