如何使Web服务(preferably使用PHP),可以要求Android应用程序获取JSON对象 [英] How to make a web service (preferably using PHP) that can be requested to get JSON objects by the android app
问题描述
我想提出一个Android应用程序,它交互的远程服务器上的数据库,并互相传递JSON对象和沟通。
I am making an Android App which interacts with remote server's database and communicate with each other by passing JSON object to and from.
我需要知道如何在我的服务器上写这样的服务(preferably在PHP)到Android应用程序可以请求,并在收到请求时,服务器进程,使一个JSON对象,并通过了以Android应用程序。
I need to know how to write such a service on my server (preferably in PHP) to which the android app can make request and on receiving the request, the server processes and makes a JSON object and passes that to the android app.
另外,我需要知道,当此服务运行在服务器上,在哪些的URL将Android应用程序进行申请?
Also, i need to know, when this service is running on the server, on WHICH URL will the android app make request?
例如,如果Android应用程序有要求断绝获取的参数数据: 名称:苹果 位置:美国 那么,我猜的Android应用程序将不得不请求服务器中的形式: www.example.com?name='Apple"&location='US
For example, if android app have to request to sever to fetch data for parameters: name: Apple location: US then, i guess the android app will have to request the server in form of: www.example.com?name='Apple"&location='US'
那么如何让这样的服务在远程服务器上运行?
So how to make such a service running on the remote server?
在此先感谢!
推荐答案
您可以参考这个最好的例子是<一个href="http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/">http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/.它具有完整的code [PHP +安卓]用简单的解释。
The best example you can refer for this is http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/. It has complete code[php+ android] with simple explanation.
这篇关于如何使Web服务(preferably使用PHP),可以要求Android应用程序获取JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!