title: HttpURLConnection doing a get request even after setDoOutput(true), setRequestMethod("POST") setRequestProperty("Content
body: <p>Here is the code:</p>
  
  <pre><code>String Surl = "http://mysite.com/somefile";
  String charset = "UTF-8";
  query = String.format("param1=%s&amp;param2=%s",
  URLEncoder.encode("param1", charset),
  URLEncoder.encode("param2", charset));
  
  HttpURLConnection urlConnection = (HttpURLConnection) new URL(Surl + "?" + query).openConnection();
  urlConnection.setRequestMethod("POST");             
  urlConnection.setDoOutput(true);
  urlConnection.setUseCaches(false);
  urlConnection.setAllowUserInteraction(false);
  urlConnection.setRequestProperty("Accept-Charset", charset);
  urlConnection.setRequestProperty("User-Agent","&lt;em&gt;Android&lt;/em&gt;");
  urlConnection.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=" + charset);                
  urlConnection.connect();
  </code></pre>
  
  <p>The above still does a <code>GET</code> request. I am using PHP on the server and am able to access the query's 'name=value' params through the <code>$_GET</code> variable and not the <code>$_POST</code> variable<br>
  Tested on 2.3.7(device). </p>
  
  <p>What am I missing ?</p>