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 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行