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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?