title: Java HttpURLConnection and php
body: <p>I can't get the value using php post. My code is:</p>
  
  <pre><code>InputStream is;
  URL url = new URL(targetURL);
  String request = "request=" + parameter;
  Log.d("Light", "Url data:" + request);
  connection = (HttpURLConnection) url.openConnection();
  connection.setRequestMethod("POST");
  connection.setUseCaches(false);
  connection.setDoInput(true);
  connection.setDoOutput(true);
  DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
  wr.writeBytes(request);
  wr.flush();
  wr.close();
  </code></pre>
  
  <p>parameter value assign using </p>
  
  <pre><code> JSONObject obj = new JSONObject();
   obj.put("id", requestModel.Id);
   obj.put("name", !requestModel.Name.equals("") ? requestModel.Name : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   obj.put(ManufacturesTableAdapter.KEY_MANUFACTURES_ADDRESS, !requestModel.Address.equals("") ? requestModel.Address : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   obj.put("city", !requestModel.City.equals("") ? requestModel.City : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   obj.put("state", !requestModel.State.equals("") ? requestModel.State : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   obj.put("zip", !requestModel.Zip.equals("") ? requestModel.Zip : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   obj.put(ManufacturesTableAdapter.KEY_MANUFACTURES_PHONE, !requestModel.Phone.equals("") ? requestModel.Phone : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   obj.put(ManufacturesTableAdapter.KEY_MANUFACTURES_EMAIL, !requestModel.Email.equals("") ? requestModel.Email : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
   switch (apiName) {
       case JsonWriteContext.STATUS_OK_AFTER_COLON /*2*/:
           obj.put("questions", !requestModel.Questions.equals("") ? requestModel.Questions : MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
           break;
   }
   return obj.toString();
  </code></pre>
  
  <p>I save the $_SERVER, $_GET, $_POST details but I can't get anything like get, post and server data.</p>