BufferedReader in = null;
try {
String url = "abc";
String parameter = "a=b";
url = url + URLEncoder.encode(parameter, "UTF-8");
URL obj = new URL("http://www.test.co.kr/test.jsp"); // 호출할 url
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("GET");
in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
String line;
while((line = in.readLine()) != null) { // response를 차례대로 출력
System.out.println(line);
}
} catch(Exception e) {
e.printStackTrace();
} finally {
if(in != null)
try {
in.close();
} catch(Exception e) {
e.printStackTrace();
}
}
'develop > java' 카테고리의 다른 글
엑셀업로드 (0) | 2021.05.25 |
---|---|
poi 기본 샘플 (0) | 2017.11.20 |
JAVA - 주소로 위경도 및 격자좌표 구하기 (0) | 2016.12.27 |
월 일별로 데이터 넣기 (0) | 2016.11.01 |
JAVA 파일 업로드 및 썸네일 생성 및 FTP 파일 업로드 (0) | 2016.05.18 |