title: How to call a specific method in RestFul API?
body: <p>I have created this code:</p>
  
  <pre><code>header("Content-Type: application/json");
  
  $method = $_SERVER['REQUEST_METHOD'];
  $request = explode("/", substr(@$_SERVER['PATH_INFO'], 1));
  
  switch ($method) 
  {
    case 'PUT':
      break;
    case 'POST':
      do_something_with_post($request);  
      break;
    case 'GET':
      do_something_with_get($request);  
      break;
    case 'DELETE':
      do_something_with_delete($request);  
      break;
    default:
      handle_error($request);  
      break;
  }
  </code></pre>
  
  <p>Now suppose that I execute this command:</p>
  
  <pre><code>curl -X GET http://localhost/api/method/1
  </code></pre>
  
  <p>so in the <code>switch</code> is fired the <code>GET</code> case, how I can call the function <code>method</code> and pass the parameter <code>1</code>? 
  how I should configure the code on the switch? Someone could help me to figure out?</p>