Skip to content

Instantly share code, notes, and snippets.

@nfaltermeier
Created January 2, 2017 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfaltermeier/551af7b15415611264729ecbd1016482 to your computer and use it in GitHub Desktop.
Save nfaltermeier/551af7b15415611264729ecbd1016482 to your computer and use it in GitHub Desktop.
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();
}
}
}
@shmosel
Copy link

shmosel commented Jan 2, 2017

This works fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment