Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GetData(Products products) throws IOException {
- {
- //GET POST SETUP
- URL url = new URL("https://fredagscafeen.dk/api/items/?format=json");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("GET");
- //STREAM READER SETUP
- BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- //SETUP STRING BUILDER
- String line;
- StringBuilder result = new StringBuilder();
- //RUNS THROUGH ALL THE DATA
- while ((line = rd.readLine()) != null) {
- result.append(line);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement