sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
import java.io.*;
import java.net.*;
public class EmpasSearch
{
public static void main(String[] args) throws Exception
{
//http://search.empas.com/search/all.html?a=w&s=&f=&z=A&q=신해철
String keyword = null;
//keyword = "신해철";
keyword = URLEncoder.encode("신해철");
String query = "a=w&s=&f=&z=A&q=" + keyword;
String empasURL = "http://search.empas.com/search/all.html";
URL url = new URL(empasURL);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setDefaultUseCaches(false);
PrintWriter out = new PrintWriter(connection.getOutputStream());
out.println(query);
out.close();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line = null;
while((line = in.readLine()) != null)
{
System.out.println(line);
}
in.close();
}
}
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
11 | 일본어 전각 반각 변환 예제 소스 .첫번째 | 황제낙엽 | 2007.01.10 | 3070 |
10 | 환경파일 로드 클래스 구성 (XML파싱) | 황제낙엽 | 2007.01.05 | 62 |
9 | HttpURLConnection을 사용하여 웹 페이지 액세스하기 (두번째) | 황제낙엽 | 2007.01.05 | 50 |
8 | 자바의 I/O 예제 [1] | 황제낙엽 | 2006.12.28 | 50 |
» | HttpURLConnection 클래스를 이용한 Search | 황제낙엽 | 2006.12.28 | 260 |
6 | HttpURLConnection을 사용하여 웹 페이지 액세스하기 (첫번째) | 황제낙엽 | 2006.12.28 | 57 |
5 | Servlet으로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 112 |
4 | JSP로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 77 |
3 | 파일 Download로직 구현시에 참고할만한 내용 | 황제낙엽 | 2006.12.27 | 95 |
2 | 파일을 web 이외의 경로에 올린다음 보내는 코드 예제 (JDK1.3) | 황제낙엽 | 2006.12.27 | 24 |
1 | NestedRuntimeException | 황제낙엽 | 2006.09.22 | 988 |