就是去除cookie组装成url字符串,然后添加到后面,重新设置url!
你的采纳是我前进的动力,
记得好评和采纳,答题不易,互相帮助,
手机提问的朋友在客户端右上角评价点(满意)即可.
如果你认可我的回答,请及时点击(采纳为满意回答)按钮!!
httppost添加cookie的方法具体如下:第一种
HashMap map = new HashMap()
map.put("cookie","p1u_id=4eb591e73554db0f4d3300cb656113abfb968ef6b0ee2b5de0a35caa5217c51faa028b453576b35c")
networkConnection.setHeaderList(map)
NetworkConnection.ConnectionResult result = networkConnection.execute()
第二种是用okhttp
OkHttpClient client = new OkHttpClient()
String returnData=null
com.squareup.okhttp.Request request = new com.squareup.okhttp.Request.Builder()
addHeader("cookie", "p1u_id=4eb591e73554db0f4d3300cb656113abfb968ef6b0ee2b5de0a35caa5217c51faa028b453576b35c")
url(url)
.build()
Response response = null
try {
response = client.newCall(request).execute()
returnData=response.body().string()
Log.i("ss", "url is " + url + "_______RETUNRN DATA IS " + returnData)
} catch (IOException e) {
e.printStackTrace()
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)