Sometimes, the data we need to process is located in one or more web pages. In this recipe, we will demonstrate how to connect to a web page. In addition, we will extract the contents of that page.
Connecting to an HTML page
Getting ready
To prepare, we need to create a new Java project.
How to do it...
Follow these steps:
- Insert the following import statements to the project:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import...