dongshi949737 2010-05-24 01:46
浏览 53
已采纳

在WAMP Web服务器上使用PHP实现Rest API的最佳方法

I own a web server running Windows (WAMP). I want to know the best way to implement a Rest API (a very simple one) in order to let a user do something.

Diagram flow:

alt text http://img215.imageshack.us/img215/6105/flowe.png

I have programming skills, in fact, I developed a web server in VB6 who process the queries and when it finds the command (http:/serverIP/webform.php?cmd=run&item=any) it does something, but I really want to develop a solution using the WAMP server.

Some people consider the solution of executing a exe when a command is detected a bad solution for security issues, but this specific project I have is for the use by some people (trusted people) who dont have intentions of hacking the server.

So, what do you think?

Remember:

  1. Its not a public API, its for some people and some programs who will use the API
  2. Its a very simple one, only one command using POST or GET.

Thanks

  • 写回答

1条回答 默认 最新

  • doudilin1225 2010-05-24 01:56
    关注

    Ive just recently finished a REST API project on PHP and it was a good experience. The way I see it, the fastest/easiest way to implement this is using the following elements:

    • Object Oriented PHP
    • MVC paradigm
    • Create a request dispatcher

    I found this link very useful when I started, it should get you going in no time:

    http://particletree.com/features/how-to-add-an-api-to-your-web-service/

    Edit:

    I didnt use this framework but it looked promising: http://tonic.sourceforge.net/

    Also, CakePHP supports Rest and is a neat MVC framework. If you're looking to implement in no time, go with CakePHP.

    Good luck!

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

报告相同问题?

悬赏问题

  • ¥20 matlab计算中误差
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊