title: Http post how to add parameter to my URL
body: <p>I want to add my Fbid to php DB , how can I do this?</p>
  
  <pre><code>private class HttpAsyncTask extends AsyncTask&lt;String, Void, String&gt; {
  
      @Override
      protected String doInBackground(String... data) {
          String result = null;
          try {
              // 1. create HttpClient
              URL url = new URL(data[0]);
              HttpURLConnection connection = (HttpURLConnection) url.openConnection();
              connection.setReadTimeout(10000);
              connection.setConnectTimeout(15000);
              connection.setRequestMethod("POST");
              connection.setDoInput(true);
              List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
              params.add(new BasicNameValuePair("fbid", fbid));
  
              OutputStream os = connection.getOutputStream();
              BufferedWriter writer = new BufferedWriter(
                      new OutputStreamWriter(os, "UTF-8"));
              writer.write(getQuery(params));
              writer.flush();
              writer.close();
              os.close();
              connection.connect();
  
          } catch (Exception e) {
              Log.d("InputStream", e.getLocalizedMessage());
          }
          return result;
      }
  
  
      private String getQuery(List&lt;NameValuePair&gt; params) throws UnsupportedEncodingException {
          StringBuilder result = new StringBuilder();
          boolean first = true;
  
          for (NameValuePair pair : params) {
              if (first)
                  first = false;
              else
                  result.append("&amp;");
  
              result.append(URLEncoder.encode(pair.getName(), "UTF-8"));
              result.append("=");
              result.append(URLEncoder.encode(pair.getValue(), "UTF-8"));
          }
  
          return result.toString();
      }
  </code></pre>
  
  <p>My <code>compileSdkVersion</code> is 24 and <code>buildToolsVersion</code> "24.0.1".<br />
  Why I cant add to the db? Is that because <code>NameValuePair</code> is deprecated?</p>