had a hard time finding this so if you need to get html from an HTTPS connection in java, here is an example:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URL;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
public class EstablishSSLConnection {
/** * @param args * @throws IOException */
public static void main(String[] args) throws IOException {
String result = “”;
String urlString = “https://mystuff.com”;
URL url = new URL(urlString);
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory .getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(url .getHost(), 443);
OutputStream outstream = sslsocket.getOutputStream();
PrintWriter writer = new PrintWriter(outstream);
writer.println(“GET ” + urlString + ” HTTP/1.1″);
writer.println(); writer.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(sslsocket .getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
writer.close();
in.close();
}
}