tags:

views:

47

answers:

2

Hello In my android application i am trying to append data to url.But the data is not getting appended.Below is my code.Please correct me.

URL url=new URL("http://220.226.22.57:8780/WEB-3/client/requests/sgduTimeStampRequest.action");

        HttpURLConnection conn = (HttpURLConnection) url.openConnection();

        conn.setRequestProperty("aContentType","text/plain");
        conn.setRequestProperty("aBody","modified_since=3491039964");
        conn.setRequestMethod("POST");
        conn.setDoOutput(true); 
        conn.setDoInput(true);
        SGDUParser parser=new SGDUParser(context);
        parser.parseUpdateBinaryFile(conn.getInputStream())

Please share your valuable suggestions.

Thanks in advance :)

+1  A: 

The raw HTTP Request with POST should look like as follows:

POST /login.jsp HTTP/1.1
Host: www.mysite.com 
User-Agent: Mozilla/4.0
Content-Length: 27
Content-Type: text/plain

userid=joe&password=guessme

You need to call conn.getContent()

Ankit Jain
Thanks Ankit.But i am not clear with what you are trying to say.Could you please share some code with me.
Remmyabhavan
I am placing my code above pls check
Remmyabhavan
I tried conn.getcontent but its not working
Remmyabhavan
A: 

In the code posted by you... you are not appending data to url or in words you are not making any get request. Here you are making Post request to url.

success_anil