In my android application I am trying to append data to url. But the data is not appending .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();
开发者_JS百科 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 :)
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()
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.
精彩评论