0

Possible Duplicate:
How to implement communication between Java client application (Android) and PHP server application?

I'm busy with a project. My android app needs to request server info from time to time.

The solution i came up with was to write a php script. But how do you let the android java app communicate with the PHP script ?

I was thinking about something with a post/get request and the php script returning a html file with strings ?

Would love some advice, thanks in advance :)

0

3 Answers 3

2

see this tutorial it will help you

connection between php android using http and json

Sign up to request clarification or add additional context in comments.

Comments

1

From Android, do HTTP GET/POST requests to reach the PHP script. Have the PHP script return JSON formatted data - much easier to parse and deal with than HTML.

Comments

1

you can exchange array between them by JSON,most of language support JSON. in php you can use json_encode(); json_decode(); to make json array.and Java should have something same as it. eg:


$array = array(
            "fname" => "Moein"
            "lname" => "Hoseini"
); $js = json_encode($array);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.