| 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
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| » | HttpURLConnection 클래스를 이용한 Search | 황제낙엽 | 2006.12.28 | 1997 |
| 6 | HttpURLConnection을 사용하여 웹 페이지 액세스하기 (첫번째) | 황제낙엽 | 2006.12.28 | 1834 |
| 5 | Servlet으로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 1699 |
| 4 | JSP로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 3858 |
| 3 | 파일 Download로직 구현시에 참고할만한 내용 | 황제낙엽 | 2006.12.27 | 1765 |
| 2 |
파일을 web 이외의 경로에 올린다음 보내는 코드 예제 (JDK1.3)
| 황제낙엽 | 2006.12.27 | 1751 |
| 1 | NestedRuntimeException | 황제낙엽 | 2006.09.22 | 2493 |