tags:

views:

120

answers:

1

Hello, 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

I have programming skills, in fact, i developed some time ago a web server in VB6 who process the querys and when it find the command (http:/serverIP/webform.php?cmd=run&item=any) it do something, but know 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 proyect i have is for the use of only 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  A: 

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!

dabito
Thanks, but the tutorial you gave me use only common operations on server side like mysql querys. I need to execute programs on my server who process the data that comes from the post method
DomingoSL
You can just follow the tutorial for the rpc part and use php's exec command (http://php.net/manual/en/function.exec.php) for the actual program execution.
dabito