All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rillis.Internet.HTMLUtils Maven / Gradle / Ivy

package com.github.rillis.Internet;

import java.net.URL;
import java.net.URLConnection;
import java.util.Scanner;

public class HTMLUtils {
	public static String getHTML(String url) {
		String content = null;
		URLConnection connection = null;
		try {
		  connection =  new URL(url).openConnection();
		  Scanner scanner = new Scanner(connection.getInputStream());
		  scanner.useDelimiter("\\Z");
		  content = scanner.next();
		  scanner.close();
		}catch ( Exception ex ) {
		    ex.printStackTrace();
		}
		return content;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy