System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 6492 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
96 | System/OS | [linux] Proftpd 설치 가이드 | hooni | 2003.04.23 | 13846 |
95 | System/OS | [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문) | hooni | 2003.04.23 | 13777 |
94 | System/OS | [linux] DHCP(Dynamic Host Configuration Protocol) 서버 | hooni | 2003.04.23 | 13742 |
93 | System/OS | [router] 시스코 라우터 명령어 모드.. | hooni | 2013.04.23 | 13676 |
92 | System/OS | [linux] root 전환시 패스워드 없이 su 사용하기 | hooni | 2013.12.22 | 13639 |
91 | System/OS | [linux] 프로세스 상태확인(ps) | hooni | 2003.04.23 | 13548 |
90 | System/OS |
[doc] 피쳐셀렉션(feature selection using..) 발표 자료
![]() |
hooni | 2013.04.23 | 13532 |
89 | System/OS | [unix] SUN Solaris 싱글모드.. ㅡ,.ㅡ; | hooni | 2003.04.23 | 13433 |
88 | System/OS |
[linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기
![]() |
hooni | 2014.01.09 | 13431 |
87 | System/OS | [linux] 스케쥴링 순서(nice) 변경하기 | hooni | 2003.04.23 | 13377 |
86 | System/OS | [sql] alter table 쿼리 예제 | hooni | 2003.04.23 | 13317 |
85 | System/OS | [linux] 파일내 문자열 찾아 바꾸기 | hooni | 2013.04.23 | 13299 |