1, the use of post to submit the need not to pass the number of references written in the URL, be sure to use Basicnamevaluepair this class to complete
Create a URL that I want to send a similar get method----------http://localhost/app/camera.php?
Opt=discovery
Do not pass the following parameters directly to the past when submitting using post. Be sure to use the following method
HttpClient client = new Defaulthttpclient (); HttpPost post = new HttpPost ("http://localhost/app/camera.php");//Set HTTP POST request parameters must be Namevaluepair object list< namevaluepair> params = new arraylist<namevaluepair> ();p Arams.add (new Basicnamevaluepair ("opt", "discovery" ); try {post.setentity (new urlencodedformentity (params, HTTP). Utf_8)); HttpResponse response = Client.execute (POST), if (Response.getstatusline (). Getstatuscode () = = () {String string = Entityutils.tostring (Response.getentity ()); System.out.println (string);//toast.maketext (Mainactivity.this, Response.getstatusline (). Getstatuscode (), 1). Show ();} else {//toast.maketext (mainactivity.this, Response.getstatusline (). Getstatuscode (), 1). Show ();}} catch (Clientprotocolexception e) {//Todo auto-generated catch Blocke.printstacktrace ();} catch (IOException e) {//TODO Auto-generated catch Blocke.printstacktrace ();}
Android uses post submission