Forever Zero
07-25-2008, 05:31 PM
Hello all,
I have this method to grab an InputStream containing the HTML of a web page:
/**
* Get an InputStream of HTML from a URL
* @param urlString the URL to get HTML from
*/
private static InputStream getIS(String urlString) {
try {
URL url = new URL(urlString);
java.net.HttpURLConnection httpURL = ( java.net.HttpURLConnection ) url.openConnection();
httpURL.setRequestProperty ( "User-Agent", "Mozilla/5.0 ( compatible ) " );
InputStream inputStream = httpURL.getInputStream();
return inputStream;
} catch (IOException ex) {
return null;
}
} // getIS
I was wondering if there is a way to do this same thing, but use an SSL connection?
Any would would be much appreciated.
I have this method to grab an InputStream containing the HTML of a web page:
/**
* Get an InputStream of HTML from a URL
* @param urlString the URL to get HTML from
*/
private static InputStream getIS(String urlString) {
try {
URL url = new URL(urlString);
java.net.HttpURLConnection httpURL = ( java.net.HttpURLConnection ) url.openConnection();
httpURL.setRequestProperty ( "User-Agent", "Mozilla/5.0 ( compatible ) " );
InputStream inputStream = httpURL.getInputStream();
return inputStream;
} catch (IOException ex) {
return null;
}
} // getIS
I was wondering if there is a way to do this same thing, but use an SSL connection?
Any would would be much appreciated.