System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 3650 댓글 1
첨부 '1' |
|
---|
라이브러리 안 쓰고 간단한 POST 전송하는 예제
public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.hooni.net/ip.php"); try { // Add your data List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("id", "hooni")); nameValuePairs.add(new BasicNameValuePair("passwd", "ok!")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } }
[출처] http://stackoverflow.com/questions/2938502/sending-post-data-in-android
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
34 | System/OS | [linux] 랜카드가 2개 일 때 네트워크 설정 | hooni | 2003.04.23 | 30134 |
33 | System/OS | [linux] 아파치설치/설정 - 알리어싱(aliasing) | hooni | 2003.04.23 | 51456 |
32 | System/OS | [linux] 아파치설치/설정 - 사용인증 | hooni | 2003.04.23 | 15150 |
31 | System/OS | [linux] 아파치설치/설정(모니터링) | hooni | 2003.04.23 | 14222 |
30 | System/OS | [linux] 아파치 설치/설정(proxy) | hooni | 2003.04.23 | 13012 |
29 | System/OS | [linux] 아파치설치/설정 - SSI(Server Side Include) | hooni | 2003.04.23 | 13261 |
28 | System/OS | [linux] 아파치설치/설정(CGI부분) | hooni | 2003.04.23 | 14625 |
27 | System/OS | [linux] 아파치설치/설정 | hooni | 2003.04.23 | 14555 |
26 | System/OS | [linux] 새 하드디스크 추가하기..(내공쌓기) | hooni | 2003.04.23 | 13857 |
25 | System/OS | [linux] 기본적인 설정하기(내공쌓기) | hooni | 2003.04.23 | 14056 |
24 | System/OS | [linux] 계정관리하기(내공쌓기) | hooni | 2003.04.23 | 13320 |
23 | System/OS | [linux] 프로그램 설치방법 (내공쌓기) | hooni | 2003.04.23 | 13495 |