How to receive data from php server by delphi client through HTTP connection?

请我需要知道如何将参数从Delphi应用程序发送到PHP页面,然后PHP会对这些参数进行一些计算并将结果再次返回给Delphi?


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) Your Delphi client gets the page, passing all the parameters as HTTP GET or HTTP POST.

  • http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
  • How are parameters sent in an HTTP POST request?

  • What's the simplest way to call Http GET url using Delphi?

  • What's the simplest way to call Http POST url using Delphi?
  • Synapse Delphi HTTPS SSL GET Request
  • 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
  • et cetera

    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) your Delphi client getting the page via HTTP, then parses JSON and works with the resulting variables

    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) do with the received data what you want to do

    链接地址: http://www.djcxy.com/p/41340.html

    上一篇: 用HttpURLConnection发送二进制数据

    下一篇: 如何通过HTTP连接从delphi客户端接收来自php服务器的数据?