How to make HTTPS post request in Java? [duplicate]
问题 This question already has answers here : “PKIX path building failed” and “unable to find valid certification path to requested target” (31 answers) Closed 3 years ago . I'm trying to make a HTTPS post request. String url = "https://myhttpsurl.com" URL myurl = new URL(url); HttpsURLConnection con = (HttpsURLConnection) myurl.openConnection(); con.setRequestMethod("POST"); String query = "confirmation_number=" + URLEncoder.encode(confNumber, "UTF-8"); con.setRequestProperty("Content-length"