开发者

append data to url in android

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜