douwen5741 2013-09-19 15:45
浏览 35
已采纳

PHP Server在任何语言平台上为客户提供服务?

I need to have a data supply Server with PHP to serve (returning data to) any Client Applications from any universal programming language platforms like, i.e. Java, .NET, Python, iOS, C#, C++, etc.

First few questions would be:

  • Would that one be even called API or Web Service?
  • If Web Service, which one should it be? (In PHP Docs, the WebServices are OAuth, SCA, SOAP, XML-RPC)

Then which particular approach should i use? (in such common scenarios) Which PHP implementation would be make the Server to communicate with ANY MAJOR programming platforms?

  • 写回答

1条回答 默认 最新

  • duan00529 2013-09-19 16:25
    关注

    Its a webservice (btw you are a bit confused about what is an API layered on top of a web-service)

    As for formatting the data....that's up to you.

    SOAP - is a very formal and complex method of describing data and metadata - which is computationally expensive on both client and server. It defines both the request as well as the response

    XML-RPC is a simpler system based on XML - again request and response are XML

    JSON is increasingly widespread - much simpler.

    Serialized PHP is also comonplace (there are tools available for C#, Java, Ruby, Python...)

    At the end of the day, they ALL USE TEXT to comunicate - hence will work with ANY MAJOR programming platform (even if they used binary data, its still data hence should be parseable by anything which can talk HTTP).

    IMHO SOAP is somewhat overcomplicated unless you're trying to keep systems in sync using evolving APIs. YAML is...only for Ruby programmers. Serialized PHP is easy to implement but difficult to document. If it were me, I'd go with JSON (do have a google for JSON schema).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助