如何通过HTTP连接delphi客户端从php服务器接收数据? [英] How to receive data from php server by delphi client through HTTP connection?
问题描述
我需要知道如何将参数从Delphi应用程序发送到php页面然后php会对这些参数进行一些计算并将结果再次返回给Delphi吗?
Please I need to know how to send parameters from Delphi application to php page then php will make some calculations on these parameters and return result again to Delphi?
推荐答案
REST模式中的一种直接方式( http:// en .wikipedia.org / wiki / REST )将是:
One of straight-forward ways in REST pattern (http://en.wikipedia.org/wiki/REST) would be:
- Getting JSON data from a website using Delphi
- How to send/receive JSON?
1)您的Delphi客户端获取页面,将所有参数作为HTTP GET或HTTP POST传递。
1) Your Delphi client gets the page, passing all the parameters as HTTP GET or HTTP POST.
使用Delphi调用Http GET url的最简单方法是什么?
使用您想要的任何库。一些选择(不完整列表)包括:
using any library you wish. Some choices (not complete list) include:
- WinInet(Windows系统库) http://msdn.microsoft.com
- Internet组件套件 http://OverByte.be
- Internet Direct http://indyproject.org
- Synapse http:// synapse .ararat.cz
- 来自JediVCL的URL抓取器 http:// jVCL .sf.net
- 部分mORMot框架 http://synopse.info
- WinInet (Windows system library) http://msdn.microsoft.com
- Internet Component Suite http://OverByte.be
- Internet Direct http://indyproject.org
- Synapse http://synapse.ararat.cz
- URL Grabber from JediVCL http://jVCL.sf.net
- parts of mORMot framework http://synopse.info
等等
2)您的PHP服务器获取那些参数并生成带有结果的JSON页面
2) your PHP server gets those parameters and generates JSON page with the results
- 如何使用php生成json? - 以及指向手册和教程的所有链接
- How to generate json using php? - and all the links to manuals and tutorials there
3)你的Delphi客户端通过HTTP获取页面,然后解析JSON并使用生成的变量
3) your Delphi client getting the page via HTTP, then parses JSON and works with the resulting variables
一些解析JSON的库是
Some libraries to parse JSON are
- SuperObject Delphi / SuperObject - 访问子节点和 SuperObject - Extract All 和其他 superobject 问题
- mORMot框架的一部分 http://synopse.info
- 在Delphi Enterprise中使用DB Express https://stackoverflow.com / search?q = delphi + TJSONObject
- SuperObject Delphi / SuperObject - Accessing Subnodes and SuperObject - Extract All and other superobject questions
- parts of mORMot framework http://synopse.info
- Using DB Express in Delphi Enterprise https://stackoverflow.com/search?q=delphi+TJSONObject
4)收到的信息数据你想做什么
4) do with the received data what you want to do
这篇关于如何通过HTTP连接delphi客户端从php服务器接收数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!