title: Sending $http.post data in Angular. Php receive empty data
body: <p>Like the title said. I want to make a $http.post request to my backend in php, but is not working. Let me show you my code at today:</p>
  
  <pre><code>function obtenerSesion() { 
          return $http.post(loginUrl,
                   {params: {
                       username: 'prueba123',
                       password: 'prueba123'}
                   })
              .then(function(response) {
                  debugger;
                  canchas = response.data;
                  return canchas;
          })
          .catch(generarError);
      }
  </code></pre>
  
  <p>In my PHP I have this:</p>
  
  <pre><code>.
  .
  22.    $nombreUsuario= $_POST["username"];
  23.    $contrasenia=    $_POST["password"];
  .
  .
  </code></pre>
  
  <p>I receive in the response status "200" but error.txt catch this when the php is execute:</p>
  
  <blockquote>
    <p>Undefined index on line 22</p>
  </blockquote>
  
  <p>Could you tell me, Why my php is not receiving the data?
  Thanks!</p>
  
  <p><strong>//EDIT//</strong></p>
  
  <p>login.php</p>
  
  <pre><code>&lt;?php
  $response = array();
  
  require("Db.class.php");
  require("password.php");
  require("jwt.php");
  
  $settings = parse_ini_file("settings.ini.php");
  $securityToken= '' . $settings["token"]. '';
  
  $db = new Db();
  
  $nombreUsuario= $_POST["username"]; //email o user
  $contrasenia=   $_POST["password"];
  
  // $hash = password_hash($contrasenia, PASSWORD_BCRYPT);
  
  
  $result = $db-&gt;query("SELECT ....);
  
  if(count($result) == 0){
      ...
      ...
  </code></pre>
  
  <p>If I hardcode the $nombreUsuario='prueba123' and $contrasenia='prueba123' the php works perfect!</p>