Java HTTPS Client
February 23, 2011 ・0comments ・Topic: Java
Here is example for a Java HTTPS client
import java.net.URL;
import java.io.*;
import javax.net.ssl.HttpsURLConnection;
public class HttpsClient{
public static void main(String[] args) throws Exception{
String httpsURL = "https://encrypted.google.com/";
URL myurl = new URL(httpsURL);
HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
InputStream ins = con.getInputStream();
InputStreamReader isr = new InputStreamReader(ins);
BufferedReader in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}
in.close();
}
}
Post a Comment