title: Angular - $http.delete returns success but doesn't works
body: <p>I have an Angular + PHP application and I'm having problem to delete an customer.</p>
  
  <p>I got no error, actually, the application returns sucecess, but it doesn't delete the customer from my database.</p>
  
  <p>This is my angular controller</p>
  
  <pre><code>    app.controller('consultar_cliente_controller', function($scope, $http){
      $scope.listaDeCliente = [];
  
      var init = function(){
          $scope.buscar();
      };
  
      $scope.buscar = function(){
          $http.get('consultar_cliente.php')
               .success(function(data){
                  $scope.listaDeCliente = data;
               })
               .error(function(){
                  console.error('Erro ao executar o GET do cliente');
               });
      };
  
      $scope.deletar = function(id){
          $http.delete('remover_cliente.php/' + id)
               .success(function(){
                  console.log('Cliente removido com sucesso!');
                  $scope.buscar();
               })
               .error(function(){
                  console.error('Erro ao remover cliente');
               })
      };
  
      init();
  });
  </code></pre>
  
  <p>This is my PHP</p>
  
  <pre><code>&lt;?php
    $dbh = new PDO('pgsql:host=localhost;dbname=livraria_glp', 'postgres');
    /*
    * Recuperando todos os detalhes da requisição HTTP do Angular
    */ 
    $postdata = file_get_contents("php://input");
    $request  = json_decode($postdata);
    @$id      = $request-&gt;id;
  
    echo $id;
  
    $dbh-&gt;exec("DELETE FROM PRODUTO WHERE ID = '$id'") or die( $dbh-&gt;errorInfo() );
  
  ?&gt;
  </code></pre>
  
  <p>And this is my HTML</p>
  
  <pre><code>&lt;div class="well"&gt;
    &lt;div class="container"&gt;
        &lt;h2&gt;Dados&lt;/h2&gt;
        &lt;div class="form-group"&gt;
          &lt;label&gt;Nome&lt;/label&gt;
            &lt;input class="form-control" type="text" ng-model="filtroNome" /&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="container resultado"&gt;      
      &lt;table class="table"&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Nome&lt;/th&gt;
            &lt;th&gt;CPF&lt;/th&gt;
            &lt;th&gt;E-mail&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;tr ng-repeat="cliente in listaDeCliente | filter : filtroNome"&gt;
            &lt;td&gt;{{cliente.nome}}&lt;/td&gt;
            &lt;td&gt;{{cliente.cpf}}&lt;/td&gt;
            &lt;td&gt;{{cliente.id}}&lt;/td&gt;
            &lt;td&gt;&lt;button class="btn btn-danger" ng-click="deletar(cliente.id)"&gt;Deletar&lt;/button&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
    &lt;/div&gt;
    &lt;button class="btn btn-success" onclick="window.location.href='javascript:window.history.go(-1)'"&gt;Voltar&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Edit: I've tried this on PHP: </p>
  
  <pre><code>echo "DELETE FROM PRODUTO WHERE ID = '$id'";
  </code></pre>
  
  <p>And it returned: </p>
  
  <p>DELETE FROM PRODUTO WHERE ID = ''</p>
  
  <p>Why can't the PHP recieve the id?</p>