Rob*_*ska 20
您可以将HttpURLConnection与URL结合使用.
URL url = new URL("http://example.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
InputStream stream = connection.getInputStream();
// read the contents using an InputStreamReader
Run Code Online (Sandbox Code Playgroud)