Answer the question
In order to leave comments, you need to log in
How to get cookie for post request?
I implement the following Post-zaros:
url = new URL(url_str);
con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Content-type", "application/json; charset=utf-8");
con.setRequestProperty("Accept-Charset", "UTF-8");
con.setRequestProperty("Accept", "*/*");
con.setRequestProperty("Accept-Encoding", "gzip");
con.setRequestProperty("User-Agent:", "Android 4.0+");
con.setDoOutput(true);
con.setDoInput(true);
con.setConnectTimeout(13000);
con.setReadTimeout(11000);
con.connect();
Map<String, List<String>> map = con.getHeaderFields();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
System.out.println("Key : " + entry.getKey() +
" ,Value : " + entry.getValue());
}
String cookie = con.getHeaderField("Set-Cookie");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question