my app is working perfect when i am saving data to web server,but when i save it on local host database it is giving
Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
error..
here is my code:
try
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("www.website.com/exmpl/insertData.php"); //working perfectly
HttpPost httppost = new HttpPost("http://192.168.0.1/exmpl/insertData.php");
httppost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
Log.e("pass 1", "connection success ");
}
log cat:
01-05 19:02:53.150: E/pass 1(28604): connection success
01-05 19:02:53.410: E/Fail 3(28604): org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
EDIT errors if i change the ip address to 192.168.0.123
01-06 10:00:37.560: E/Fail 1(4261): org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.0.123 refused
01-06 10:00:37.570: E/AndroidRuntime(4261): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
and i am not using async task,,i am extending activity
even tried 192.168.0.123:80 followed MR.HU'NG
Error again
Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject