System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 3624 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
166 | System/OS | [linux] CentOS 6.x Cati 설치 (yum) | hooni | 2014.01.17 | 48657 |
165 | System/OS | [linux] CentOS Apache Httpd에 https 적용 | hooni | 2014.03.05 | 4576 |
164 | System/OS | [linux] CentOS 에 APM 설치하기 | hooni | 2015.01.02 | 1900 |
163 | System/OS | [linux] CentOS 터미널 언어 설정(한글/영어) | hooni | 2013.12.22 | 18617 |
162 | System/OS | [linux] DHCP(Dynamic Host Configuration Protocol) 서버 | hooni | 2003.04.23 | 13083 |
161 | System/OS | [linux] DNS(Domain Name System) 설치, 설정 | hooni | 2003.04.23 | 12502 |
160 | System/OS |
[linux] GD 라이브러리 설치 방법..
![]() |
hooni | 2013.04.23 | 11450 |
159 | System/OS |
[linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기
![]() |
hooni | 2014.01.09 | 12283 |
158 | System/OS | [linux] ipchains 사용예(패킷 필터링) | hooni | 2003.04.23 | 14234 |
157 | System/OS | [linux] ipchains 옵션 | hooni | 2003.04.23 | 13686 |
156 | System/OS | [linux] ipfwadm를 이용한 패킷필터링(구버전) | hooni | 2003.04.23 | 13083 |
155 | System/OS | [linux] iptables 명령어 매뉴얼(options) | hooni | 2003.04.23 | 11398 |