Created
July 9, 2018 13:37
-
-
Save atechcrew/c543947d55a72282535569360a94e609 to your computer and use it in GitHub Desktop.
Simple code to get html code of web site using java code. Get website html code simply using scanner in java.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.URL; | |
import java.util.Scanner; | |
public class GetHTML { | |
public static void main(String args[]) { | |
try { | |
URL url = new URL("http://snooker.org"); | |
Scanner scan = new Scanner(url.openStream()); | |
while(scan.hasNext()) { | |
System.out.println(scan.nextLine()); | |
} | |
scan.close(); | |
}catch(Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment