json - org.apache.http.client.HttpResponseException: Not Found error in android -


i creating application user enters data search , application sends server , server sends search result client.

i getting error not able understand means.

here networking code there application , here link full code

 public class getdatafromdb_searchresult {          public string getdatafromdb() {               try {                  httpclient = new defaulthttpclient();                 httppost = new httppost("http://192.168.0.106/test/search1.php"); // make sure url correct.                 //add data                 namevaluepairs = new arraylist<namevaluepair>(2);                 // use same variable name posting i.e android side variable name , php side variable name should similar,                 namevaluepairs.add(new basicnamevaluepair("carat1", strcolor1.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("carat2", strcolor2.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("color1", strclarity1.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("color2", strclarity2.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("cut1", strcut1.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("cut2", strcut2.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("shape1", strshape1.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("shape2", strshape2.tostring().trim()));                 namevaluepairs.add(new basicnamevaluepair("stones", strstone.tostring().trim()));                   // $edittext_value = $_post['edittext_value'];                      httppost.setentity(new urlencodedformentity(namevaluepairs));                     //execute http post request                     response = httpclient.execute(httppost);                 httpentity entity= response.getentity();                 {                     if(entity!=null)                     {                         entity.consumecontent();                     }                 }                  responsehandler<string> responsehandler = new basicresponsehandler();                 final string response1 = httpclient.execute(httppost, responsehandler);                 system.out.println("response : " + response1);              } catch (exception e) {                 e.printstacktrace();                 system.out.println("exception : " + e.getmessage());              }               return response1;          }     } 

here server side code

  <?php $hostname_localhost ="localhost"; $database_localhost ="testdb"; $username_localhost ="root"; $password_localhost =""; $localhost = mysql_connect($hostname_localhost,$username_localhost,$password_localhost) or trigger_error(mysql_error(),e_user_error);   mysql_select_db($database_localhost, $localhost);  $carat1 = $_post['carat1']; $carat2 = $_post['carat2']; $color1 = $_post['color1']; $color2 = $_post['color2']; $cut1 = $_post['cut1']; $cut2 = $_post['cut2']; $shape1 = $_post['shape1']; $shape2 = $_post['shape2']; $stones = $_post['stones'];   $query_search ="select * search1  carats = $carat1 , carats = $carat2 ,  color = '$color1' or color =  '$color2' ,   cut = '$cut1' or cut = '$cut2' ,   shape = '$shape1' or shape = '$shape2' ,   stone ='$stones'";  $query_exec = mysql_query($query_search) or die(mysql_error());       while($row=mysql_fetch_assoc($query_exec))             $json_output[]=$row;       echo json_encode($json_output);      mysql_close();  ?> 

here error logcat

06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ org.apache.http.client.httpresponseexception: not found 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ org.apache.http.impl.client.basicresponsehandler.handleresponse(basicresponsehandler.java:71) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ org.apache.http.impl.client.basicresponsehandler.handleresponse(basicresponsehandler.java:59) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:657) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:627) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:616) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ com.diamond.traders.search_result$getdatafromdb_searchresult.getdatafromdb(search_result.java:692) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ com.diamond.traders.search_result$1.run(search_result.java:88) 06-03 14:35:31.269  18943-19053/com.diamond.traders w/system.err﹕ @ java.lang.thread.run(thread.java:841) 06-03 14:35:31.269  18943-19053/com.diamond.traders i/system.out﹕ exception : not found 06-03 14:35:31.269  18943-18943/com.diamond.traders e/log_tag﹕ error parsing data org.json.jsonexception: end of input @ character 0 of 

i'm not sure suggest firstable replace line

namevaluepairs = new arraylist<namevaluepair>(2); 

by

namevaluepairs = new arraylist<namevaluepair>(); 

and in web service, have work post not get.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -