I am trying to scrape some info from a website by submitting a URL. I've had success with this code before, but I am now attempting to run the same code against url that uses the https protocal rather than http. I understand that this is some sort of secure protocal. So, I am getting the following error when trying to access this url:
Exception in thread "main" java.net.MalformedURLException: unknown protocol: https
my code is as follows:
import java.net.*;
import java.io.*;
import java.util.Date;
class getZips
{
public static void main(String args[]) throws Exception {
Thread t = Thread.currentThread();
try
{
Thread.sleep(30);
}
catch (InterruptedException e)
{
System.out.println("Main thread interrupted");
}
String mapUrl = "
URL hp = new URL(mapUrl);
URLConnection hpCon = hp.openConnection();
int len = hpCon.getContentLength();
if (len > 0)
{
InputStreamReader isr = new InputStreamReader(hpCon.getInputStream());
BufferedReader inData = new BufferedReader(isr);
String str;
while ( ( str = inData.readLine() ) != null )
{
System.out.println(str);
}//while
}//if
}//main
}//class
Does anyone know if it is still possible to do what I want to do via the https protocal or I am out of luck?
Thanks in advance
Exception in thread "main" java.net.MalformedURLException: unknown protocol: https
my code is as follows:
import java.net.*;
import java.io.*;
import java.util.Date;
class getZips
{
public static void main(String args[]) throws Exception {
Thread t = Thread.currentThread();
try
{
Thread.sleep(30);
}
catch (InterruptedException e)
{
System.out.println("Main thread interrupted");
}
String mapUrl = "
URL hp = new URL(mapUrl);
URLConnection hpCon = hp.openConnection();
int len = hpCon.getContentLength();
if (len > 0)
{
InputStreamReader isr = new InputStreamReader(hpCon.getInputStream());
BufferedReader inData = new BufferedReader(isr);
String str;
while ( ( str = inData.readLine() ) != null )
{
System.out.println(str);
}//while
}//if
}//main
}//class
Does anyone know if it is still possible to do what I want to do via the https protocal or I am out of luck?
Thanks in advance