在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:
- Its not a public API, its for some people and some programs who will use the API
- Its a very simple one, only one command using POST or GET.
Thanks
我拥有一台运行Windows的Web服务器( WAMP )。 我想知道实现Rest API(一个非常简单的)的最佳方法,以便让用户做一些事情。 p>
图表流程: p> alt text http://img215.imageshack.us/img215/6105/flowe。 png p>
我有编程技巧,事实上,我在VB6中开发了一个处理查询的Web服务器,当它找到命令时(http:/ serverIP /webform.php?cmd=run&item=any)它做了一些事情,但我真的想用WAMP服务器开发一个解决方案。 p>
有人考虑解决方案 当检测到命令是安全问题的错误解决方案时执行exe,但我所拥有的这个特定项目是供一些人(可信赖的人)使用,他们没有打算破解服务器。 p>
请记住: strong> p>
谢谢 strong> p>
div>
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!