0
我用httppost登錄。 DefaultHttpClient已棄用。但我怎樣才能得到餅乾?不推薦使用DefaultHttpClient並獲取Cookie?
request.setHeader("Content-Type", "application/json; charset=utf-8");
request.setEntity(new StringEntity(obj.toString(), "utf-8"));
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(request);
和:
我這樣之前使用
for (Cookie cookie : client.getCookieStore().getCookies()) {
if (cookie.getName().contains(".ASPXAUTH"))
return cookie;
}
,但現在,我不知道我怎樣才能餅乾嗎?
我增添了新的apache lib添加的build.gradle compile "cz.msebera.android:httpclient:4.4.1.2"
什麼是你的想法?THX