HttpClient HTTPClient = new DefaultHttpClient();
HttpConnectionParams.setSoTimeout(HTTPClient.getParams(), 15000);
HttpConnectionParams
.setConnectionTimeout(HTTPClient.getParams(), 15000);
HttpResponse response = null;
대충 이런식으로 선언하신다음,
HTTPClient = new DefaultHttpClient();
HttpConnectionParams.setSoTimeout(HTTPClient.getParams(), 15000);
HttpConnectionParams
.setConnectionTimeout(HTTPClient.getParams(), 15000);
httppost = new HttpPost(send_url);
response = null;
try {
response = HTTPClient.execute(httppost);
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(
response.getEntity().getContent(), "euc-kr"));
while (true) {
String line = br.readLine();
if (line == null)
break;
sb.append(line);
}
br.close();
result = sb.toString();/
} catch (ClientProtocolException clientprotocolexception) {
Log.i("error", clientprotocolexception.toString());
} catch (IOException ioexception) {
Log.i("error", ioexception.toString());
}
죄송 제가 1년전에 사용했던 코드 복붙하느라, 중간중간에 제 코드에 맞는 부분은 삭제하고 그래도 중요한 부분만 붙여넣기 했어요.
그냥 send_url에다가 님 서버 주소 + php 파일이름 + 변수값을 입력한 후에,
stringbuilder로 받아오세요 위에 response.getEntitiy().getcontent()로.
그럼 result에는 님 디비에 있는 원하는 데이터가 쫘아악 들어가겠쬬?
그다음에 tokenizer 같은걸로 string으로 한줄로 들어간 것을 arraylist<string> 하나 선언해서 나누어서 tokenizer로 나눈걸 add로 집어 넣으세요.