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 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法