Speed up development with full-stack environments for every branch.

Learn More

tyu [Java, url, INPUTSTREAM and BufferedReader]

Forked from Java HTTPS Client Example.

0 Runs 2 Views 0 Copies

In this example we are getting the content header from a HTTPS Client-Server Connection. We are using this website: https://www.google.com

Saved

Saved

popandrioxck 1

popandrioxck
published 11 days ago

import java.net.URL;
import java.io.*;
import javax.net.ssl.HttpsURLConnection;

public class JavaHttpsExample
{
public static void main(String[] args)
throws Exception
{
String httpsURL = "https://www.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();
}
}
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).