2017-02-13 41 views
-1

在android我發送post請求(使用齊射),但數據不在json中。 示例發送數據請求(無JSON)凌空android

POST /info HTTP/1.1 
Host: test.com 
Cookie: test_web=1234; 
Connection: keep-alive 
Content-Length: 10 

id=123 

您能幫我嗎? 在此先感謝。

+0

什麼幫助嗎? – RSon1234

+0

你能顯示你的代碼嗎? –

回答

-1

使用ION庫

dependencies { 
    compile 'com.koushikdutta.ion:ion:2.+' 
} 

用法:

Ion.with(getContext()) 
.load("https://koush.clockworkmod.com/test/echo") 
.setBodyParameter("goop", "noop") 
.setBodyParameter("foo", "bar") 
.asString() 
.setCallback(...) 

進一步信息 https://github.com/koush/ion