如何通过HTTP连接delphi客户端从php服务器接收数据? [英] How to receive data from php server by delphi client through HTTP connection?

查看:280
本文介绍了如何通过HTTP连接delphi客户端从php服务器接收数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道如何将参数从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 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

  • 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 - 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆