user1645434
user1645434

Reputation: 203

Retrieve data from Android HTTP Post

I have been looking at several other posts and what I'm trying to do is that retrieve the object over request with Android which is set.

I'm using google gcm application.

My Android the code is :

DefaultHttpClient hc=new DefaultHttpClient();
ResponseHandler <String> res=new BasicResponseHandler();
HttpPost postMethod=new HttpPost("http://192.168.1.111:8080/abc/d");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();  
nameValuePairs.add(new BasicNameValuePair("My_Value", "My_Value_entered"));  
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));  
String response=hc.execute(postMethod,res);

I want to fetch the the value My_value in my Application(in the servlet end).

Edit: If any change or modification is needed in my android code to get the object value from Android Post,feel free to reply.

Any idea.....

Upvotes: 0

Views: 169

Answers (1)

SunnySonic
SunnySonic

Reputation: 1326

You can try jsoup which is much easier to use. You can check it at jsoup.org

edit:

like this:

Document document = Jsoup.connect("http://www......com/....php")
                .data("user","user","password","12345","email","[email protected]")
                .method(Method.POST)
                .execute()
                .parse();

Upvotes: 1

Related Questions