try { URL blogFeedURL = new URL("http://blog.teamtreehouse.com/api/get_recent_summary/?count=" + NUMBER_OF_POSTS); HttpURLConnection connection = (HttpURLConnection)blogFeedURL.openConnection(); connection.connect(); responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { InputStream inputStream = connection.getInputStream(); Reader reader = new InputStreamReader(inputStream); int contentLength = connection.getContentLength(); char charArray[] = new char[contentLength]; reader.read(charArray); String responseData = new String(charArray); jsonResponse = new JSONObject(responseData); }