안녕하세요
웹페이지를 파싱해서 원하는 데이터만을 추출해오려고 합니다.
그런데 해당 페이지가 로그인을 해야만 정보를 볼수 있습니다.
그래서 로그인을 하고 세션을 유지하려고 하는데 잘 안돼네요
httpclient를 사용해서 하려고 하는데
String url = " ";
HttpClient http = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
ArrayList<BasicNameValuePair> nameValuePairs = new ArrayList<BasicNameValuePair>();
nameValuePairs.add(new BasicNameValuePair("user_id",id));
nameValuePairs.add(new BasicNameValuePair("passwd","pw));
HttpPost httpPost = new HttpPost(url);
try {
UrlEncodedFormEntity entityRequest = new UrlEncodedFormEntity(nameValuePairs, "UTF-8");
httpPost.setEntity(entityRequest);
http.execute(httpPost);
} catch (Exception e) {
e.printStackTrace();
}
이런식으로 해서 아이디와 패스워드 값을 보냈는데 이게 제대로 로그인이 돼는건지도 모르겠고,
로그인됐다면 어떻게 이것을 게속 유지해야 할지도 모르겠습니다.




유지하는 것은 쿠키값을 저장하시면 됩니다.