首页 > 代码库 > Android Cookie(HTTP使用)

Android Cookie(HTTP使用)

HttpGet request = new HttpGet(
"http://xxxx.xxx/xxxxx");
request.setHeader("Cookie", "key=" + “xxxxxxxxxxx”);
HttpResponse response = httpclient.execute(request); // 模拟请求
int code = response.getStatusLine().getStatusCode();// 返回响应码
InputStream in = response.getEntity().getContent();// 服务器返回的数据
System.out.println(inputStreamToString(in));

Android Cookie(HTTP使用)