title: PHP web service for authenticating user login on Android
body: <p>Trying to get the user authentication work on Android. </p>
  
  <p>The Android app sends username and password using POST method. But, I keep getting "Error receiving detail!!" error. I tried to use REST console to see if the web service works, but no success, I get the same error even there.</p>
  
  <p>Any help or direction would be appreciated.</p>
  
  <p>Have built a PHP web service and the code is:</p>
  
  <pre><code>&lt;?php
  
  require_once '../site_info.php';
  require_once '../database_connect.php';
  require_once '../functions.php';
  
  if(isset($_REQUEST['email']) and $_REQUEST['email']!='' and isset($_REQUEST['password']) and $_REQUEST['password']!='')
  {
      $email = mysql_real_escape_string($_REQUEST['email']);
      $pass = mysql_real_escape_string($_REQUEST['password']);
  
      $query = 'select id from users where email = "'.$email.'" and password = "'.sha1($pass).'"';
      $result=mysql_query($query) or die('error getting admin details : '.mysql_error());
  
      if(mysql_num_rows($result)==1)
      {
          echo 'Login Success!!';
      }
      else
      {
          echo 'Incorrect login details!!';
      }
  }
  else
  {
      echo 'Error recieving data!!';
  }
  
  ?&gt;
  </code></pre>
  
  <p>The Android app sends request as json:</p>
  
  <p>JOSN request data:{"password":"password","email":"test@gmail.com"}</p>
  
  <p>response</p>
  
  <p>status:200</p>
  
  <p>response body:array(0) {}Error recieving data!!</p>