title: How to pass a value from android to php web service and retrieve it?
body: <p>I'm trying to pass a value to my php webservice. I already use this code for pass the "name" value :</p>
  
  <pre><code> private class MyAsyncTask extends AsyncTask&lt;String, Void, Void&gt; {
  
      protected Void doInBackground (String... params)
      {
              Intent intent = getIntent();
              String name = intent.getStringExtra("KEY_NAME");
              //HttpClient httpclient = new DefaultHttpClient();
              HttpPost httppost = new HttpPost("http://10.0.2.2/secure_login/get_data_user.php");
  
              List&lt;NameValuePair&gt; nameValuePair = new ArrayList&lt;NameValuePair&gt;(1);
              nameValuePair.add(new BasicNameValuePair("KEY_NAME", name));
              DefaultHttpClient hc = new DefaultHttpClient();
             // HttpResponse response = hc.execute(httppost);
  
  
              try {
                  httppost.setEntity(new UrlEncodedFormEntity(nameValuePair));
              } catch (UnsupportedEncodingException e){
                  // writing error to log
                  e.printStackTrace();
              }
  
              try {
                  HttpResponse response = hc.execute(httppost);
                  HttpEntity entity = response.getEntity();
                  InputStream inStream = entity.getContent();
                  // writing response to log
                  Log.d("Http Response:", response.toString());
  
                 } catch (ClientProtocolException e) {
                     // writing exception to log
                     e.printStackTrace();
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
              return null;
  
  
  
      }
  </code></pre>
  
  <p>And this, for convert Stream to String.</p>
  
  <pre><code>          protected String convertStreamToString(InputStream inStream)
              {
                 BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
                 StringBuilder sb = new StringBuilder();
  
                 String line = null;
                 try 
                 {
                     while ((line = reader.readLine()) != null) 
                     {
                         sb.append(line + "\n");
                     }
                 } 
                 catch (IOException e) 
                 {
                     e.printStackTrace();
                 } 
                 finally 
                 {
                     try 
                     {
                         inStream.close();
                     } 
                     catch (IOException e) 
                     {
                         e.printStackTrace();
                     }
                 }
                 return sb.toString();
              }
    }
  </code></pre>
  
  <p>But I only got this response in log cat :
  org.apache.http.message.BasicHttpResponse@43e4c068</p>
  
  <p>I need to pass the "name" value so my php webservice can retrieve and do the query like this :</p>
  
  <pre><code> if (isset($_GET['name'])) {
  $name = $_GET['name'];
  
  require_once 'DB_Functions.php';
  $db = new DB_Functions();
  $result = mysql_query("SELECT name, email from users where name = '$name'");
  </code></pre>
  
  <p>How do I should fix it? Thank you in advance.</p>