Created
January 2, 2017 04:14
-
-
Save nfaltermeier/551af7b15415611264729ecbd1016482 to your computer and use it in GitHub Desktop.
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.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
public class GetURLContents { | |
public static void main(String[] args) { | |
try { | |
URL url = new URL("http://steamcommunity.com/id/lotrfan45/games?xml=1"); | |
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); | |
String line; | |
String contents = ""; | |
while ((line = br.readLine()) != null) { | |
contents += line; | |
} | |
System.out.println(contents); | |
} catch (MalformedURLException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works fine for me.