System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 3477 댓글 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 | [switch] 시스코 스위치 관리자 암호 초기화 방법 | hooni | 2013.04.23 | 17188 |
165 | System/OS | [svn] 하나의 SVN에서 멀티 저장소 (One svnserve, multiple repositories) | hooni | 2015.01.02 | 1549 |
164 | System/OS | [svn] SVN trunk 변경사항 되돌리기 (SVN Rollback) | hooni | 2014.11.27 | 1564 |
163 | System/OS | [svn] Can't convert string from native encoding to 'UTF-8' 메시지가 나오는 경우 | hooni | 2014.12.18 | 993 |
162 | System/OS | [sql] 중복데이터 삭제 쿼리 | hooni | 2013.04.23 | 14735 |
161 | System/OS | [sql] 조회구문(select)에서 중복 데이터를 한 번만 출력 (distinct) 1 | hooni | 2013.04.23 | 33929 |
160 | System/OS | [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문) | hooni | 2003.04.23 | 12845 |
159 | System/OS | [sql] insert into select 사용하기 | hooni | 2013.04.23 | 27556 |
158 | System/OS | [sql] alter table 쿼리 예제 | hooni | 2003.04.23 | 12459 |
157 | System/OS | [router] 시스코 라우터 명령어 모드.. | hooni | 2013.04.23 | 12946 |
156 | System/OS | [router] 설정과 기본 명령어들 모음 | hooni | 2013.04.23 | 15671 |
155 | System/OS | [router] 라우팅 프로토콜 BGP (간단한 세팅) | hooni | 2013.04.23 | 10951 |