title: Cannot get response from PUT request using Slim Framework
body: <p>Am trying to update an existing entity in my database using PUT request but i have 2 issues, when am calling the request from phpStorm rest client debugger am getting an error </p>
  
  <pre><code>{"error":true,"message":"Required field(s) restaurant_id, service_rating, food_rating, music_rating is missing or empty"}
  </code></pre>
  
  <p>when i call the same request from Advance rest client addon on google chrome am getting </p>
  
  <pre><code>{"error":true,"message":"Task failed to update. Please try again!"}
  </code></pre>
  
  <p>so i can't understand if the real bug is on the verifyRequiredParams or in my function implementation . Am providing the code if someone can help me.</p>
  
  <p>This is my index.php file </p>
  
  <pre><code>$app-&gt;put('/userRatings/:rating_id', 'authenticate', function($rating_id) use($app) {
  // check for required params
  
  verifyRequiredParams(array('restaurant_id', 'service_rating', 'food_rating', 'music_rating'));
  
  global $user_id;
  $restaurant_id = $app-&gt;request-&gt;put('restaurant_id');
  $service_rating = $app-&gt;request-&gt;put('service_rating');
  $food_rating = $app-&gt;request-&gt;put('food_rating');
  $music_rating = $app-&gt;request-&gt;put('music_rating');
  
  
  
  $db = new DbHandler();
  $response = array();
  
  // updating rating
  $result = $db-&gt;updateRating($user_id, $rating_id, $restaurant_id, $service_rating, $food_rating, $music_rating);
  
  if ($result) {
      // rating updated successfully
      $response["error"] = false;
      $response["message"] = "Task updated successfully";
  } else {
      // task failed to update
      $response["error"] = true;
      $response["message"] = "Task failed to update. Please try again!";
  }
  echoRespnse(200, $response);
  });
  </code></pre>
  
  <p>This is the function code for the verifyRequiredParams which is located in the index.php file  </p>
  
  <pre><code>function verifyRequiredParams($required_fields) {
  $error = false;
  $error_fields = "";
  $request_params = array();
  $request_params = $_REQUEST;
  // Handling PUT request params
  if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
      $app = \Slim\Slim::getInstance();
      parse_str($app-&gt;request()-&gt;getBody(), $request_params);
  }
  foreach ($required_fields as $field) {
      if (!isset($request_params[$field]) || strlen(trim($request_params[$field])) &lt;= 0) {
          $error = true;
          $error_fields .= $field . ', ';
      }
  
  }
  if ($error) {
      // Required field(s) are missing or empty
      // echo error json and stop the app
      $response = array();
      $app = \Slim\Slim::getInstance();
      $response["error"] = true;
      $response["message"] = 'Required field(s) ' . substr($error_fields, 0, -2) . ' is missing or empty';
      echoRespnse(400, $response);
      $app-&gt;stop();
  }
  }
  </code></pre>
  
  <p>And this is my DbHandler.php file where the function is located.</p>
  
  <pre><code>public function updateRating( $user_id, $rating_id, $restaurant_id, $service_rating, $food_rating, $music_rating) {
      $stmt = $this-&gt;conn-&gt;prepare("UPDATE  user_ratings set  service_rating = ?, food_rating = ?, music_rating = ? WHERE user_id = ? AND rating_id = ? AND restaurant_id = ?");
      $stmt-&gt;bind_param("iiiiii", $user_id , $rating_id, $restaurant_id, $service_rating, $food_rating, $music_rating);
      $stmt-&gt;execute();
      $num_affected_rows = $stmt-&gt;affected_rows;
      $stmt-&gt;close();
      return $num_affected_rows &gt; 0;
  } 
  </code></pre>
  
  <p>All my connections are ok i have checked them and also my other services are working fine</p>