IT, 프로그래밍/Java
-
자바 httpURLConnection 이용한 http 통신IT, 프로그래밍/Java 2018. 7. 15. 20:00
ㅇ 1234567891011121314151617181920212223try { String apiURL = "요청할 url"; URL url = new URL(apiURL); HttpURLConnection con = (HttpURLConnection)url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader br; if(responseCode==200) { // 정상 호출 br = new BufferedReader(new InputStreamReader(con.getInputStream())); } else { // 에러 발생 br = new BufferedReader..
-
-