title: Getting randomly error of org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
body: <p>Hi i am getting this JsonException sometimes... why this happen can any body solve this problem below is my code.</p>
  
  <pre><code>  public int getResult(String name, double lat, double lon) {
          try {
              HttpClient httpclient = new DefaultHttpClient();
              String query = URLEncoder.encode(name, "utf-8");
  
              HttpPost httppost = new HttpPost("http://00004rl.rcomhost.com/demo/?json=get_dealing&amp;dev=1&amp;store_name=" + query + "&amp;longitude=" + lon
                      + "&amp;latitude=" + lat);
              JSONObject object = new JSONObject();
              StringEntity se = new StringEntity(object.toString());
              se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
              httppost.setEntity(se);
              HttpResponse response = httpclient.execute(httppost);
              HttpEntity entity = response.getEntity();
              InputStream is = entity.getContent();
              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();
              JSONObject jso = new JSONObject(sb.toString());
              if (jso.getString("status").equals("ok")) {
                  return 1;
              }
          } catch (Exception e) {
              e.printStackTrace();
              return 0;
          }
          return 0;
      }
  </code></pre>
  
  <p>i am getting below exception which is some time my logcat is below</p>
  
  <pre><code>   09-25 19:13:26.079: W/System.err(4842): org.json.JSONException: Value &lt;!DOCTYPE of type java.lang.String cannot be converted to JSONObject
     09-25 19:13:26.079: W/System.err(4842):  at org.json.JSON.typeMismatch(JSON.java:107)
     09-25 19:13:26.079: W/System.err(4842):  at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
     09-25 19:13:26.079: W/System.err(4842):  at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
     09-25 19:13:26.079: W/System.err(4842):  at com.eheuristics.android.diegodeals.googleplacesandmaps.MainActivity$LoadPlaces.getResult(MainActivity.java:246)
     09-25 19:13:26.079: W/System.err(4842):  at com.eheuristics.android.diegodeals.googleplacesandmaps.MainActivity$LoadPlaces.doInBackground(MainActivity.java:208)
     09-25 19:13:26.079: W/System.err(4842):  at com.eheuristics.android.diegodeals.googleplacesandmaps.MainActivity$LoadPlaces.doInBackground(MainActivity.java:1)
     09-25 19:13:26.079: W/System.err(4842):  at android.os.AsyncTask$2.call(AsyncTask.java:185)
     09-25 19:13:26.079: W/System.err(4842):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
    09-25 19:13:26.089: W/System.err(4842):   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
     09-25 19:13:26.089: W/System.err(4842):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
     09-25 19:13:26.089: W/System.err(4842):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    09-25 19:13:26.089: W/System.err(4842):   at java.lang.Thread.run(Thread.java:1019)
  </code></pre>