Connection between PHP (server) and Android (client) Using HTTP and JSON

The main reason for taking a scripting language like PHP is because of the interaction with databases it can offer. In this tutorial I will show you how to use PHP and the MySQL database to retrieve information from the server. For making connection to PHP script, we will  use HTTP protocol from the android system. To implement this tutorial you should have basic knowledge of how to run PHP script and start server.  If we talk about client-server architecture, client is Android device and in server side there is a combination of PHP Script and MySQL. In short, PHP Script sits in middle as shown in image.

Android – PHP – MySQL Scheme

We will use JSON (JavaScript Object Notation) format. JSON is a lightweight text-based open standard designed for human-readable data interchange. Continue reading

Advertisements