Monday, August 15, 2016

Java : Send cookie with HttpURLConnection

This is an example of how to send a cookie with an HttpURLConnection request in Java

URL url = new URL("");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// Set the cookie value to send
conn.setRequestProperty("Cookie", "name1=value1; name2=value2");
// Send the request to the server

This was an example of how to send cookies with HttpURLConnection requests in Java.

No comments:

Post a Comment