phpiosjsonweb-services

How does a server respond to a iOS device?


I would like to know how a server, running MySQL, can respond to a iOS device if they had passed info through the URL. I'm a web developer helping a friend link his app with a server and it's database.


The set up:

MySQL on server

PHP

iOS device with app to access server's urls


Technique:

The webpage will extract the $_GET parameters from the URL and query the database with the parameters. How would I pass data (the database query's data) back to the iOS device from this PHP page?

Is JSON a solution? If my .php page encodes a JSON format, will the device be able to pick up the data that is returned from the database?

I don't really know what's happening backstage with apps like flickr api and such that lets iOS devices query a database and get url strings returned to retrieve pictures. Can someone elaborate on this?


Solution

  • The server response can be anything you want. It is common for the response to be data formatted as JSON. It can be XML, plain text, or proprietary binary format. It doesn't matter. The iOS app will get the response. As long as both sides agree on a format it can be made to work.