Monday, June 29, 2009

Http Post In android

HttpResponse response;
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost("url");

httpost.setHeader("Content-Type", "application/x-www-form-urlencoded");
//Input the user id and authentication key here

StringEntity message = new StringEntity("");

httpost.setEntity(message);
ResponseHandler responseHandler = new BasicResponseHandler();

String responseBody = httpclient.execute(httpost, responseHandler);
responseBody = " Sent!";
return responseBody;

No comments: