I need to do simple http post in my app.
Found example and created AsyncTask class. The main code doing post is this:
nameValuePairs – is post elements
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL_STRING);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
HttpResponse response = httpclient.execute(httppost);
String data = new BasicResponseHandler().handleResponse(response);
How ever i get this exception
org.apache.http.client.HttpResponseException: Forbidden
What does this means ? If this something that service return, then how to see full message ?
Also if there are other way to make http post, i could try it 🙂
Thank you guys for help.
The exception
org.apache.http.client.HttpResponseExceptionSignals a non 2xx HTTP response as stated here : http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/HttpResponseException.html.You can use the simple httpPOST method as below :