views:

66

answers:

2

It's way too much work to create a restful web service. Why can't we just create a simple php page which receives requests and simply echos the JSON string. for example:

<?php
     $action = $_POST['action'];
     if (action == "users")
     {
          //get all users from DB and echo a JSON string
     }
     else if (action = "ads")
     {
          //get all ads from DB and echo a JSON string
     }
     //etc ect
?>
+3  A: 

This is one part of a restful service. It's read-only. There's nothing wrong with this approach if you don't need to do any writes.

viraptor
+1  A: 

You can. But if the requirement was to 'create a restful webservice' then you'll probably get into trouble with your boss(es) unless you have a pretty good argument as to why you took that approach :)

karim79