title: HTTP Error 414. The request URL is too long while passing data to server through java in android
body: <p>I am sending a server request with javacode in android but i am getting response code as 414. I am new to android. Please help. I am using a post method.I am using the following code:</p>
  
  <pre><code>package com.hfad.evenit;
  
  import android.util.Log;
  
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.io.BufferedInputStream;
  import java.io.BufferedReader;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;
  
  /**
   * Created by Vicky on 22-Jul-15.
   */
  public class JSONfunctions {
  
      public static JSONObject getJSONfromURL(String url1) {
          InputStream is = null;
          String result = "";
          JSONObject jArray = null;
          int response=0;
          // Download JSON data from URL
          try {
  
              URL url = new URL(url1);
              HttpURLConnection conn = (HttpURLConnection) url.openConnection();
              conn.setRequestMethod("POST");
              response = conn.getResponseCode();
              is = new BufferedInputStream(conn.getInputStream());
  
          } catch (Exception e) {
              Log.e("log_tag", "Error in http connection " + e.toString());
              Log.e("log_tag", "Response  " + response);
          }
  
          // Convert response to string
          try {
              BufferedReader reader = new BufferedReader(new InputStreamReader(
                      is, "iso-8859-1"), 8);
              StringBuilder sb = new StringBuilder();
              String line = null;
              while ((line = reader.readLine()) != null) {
                  sb.append(line + "\n");
              }
              is.close();
              result = sb.toString();
          } catch (Exception e) {
              Log.e("log_tag", "Error converting result " + e.toString());
          }
  
          try {
  
              jArray = new JSONObject(result);
          } catch (JSONException e) {
              Log.e("log_tag", "Error parsing data " + e.toString());
          }
  
          return jArray;
      }
  }
  </code></pre>
  
  <p>My url request is this:</p>
  
  <p><code>jsonObject=JSONfunctions.getJSONfromURL("http://54.169.88.65/events/eventmain/get_users.php?json="+URLencoded);</code></p>
  
  <p><code>URLencoded</code> is json data converted into string and then urlencoded.</p>