System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 3493 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
70 | System/OS | [linux] 간단한 vi편집기 사용 명령 | hooni | 2003.04.23 | 13456 |
69 | System/OS | [linux] 간단한 NAT 설정 script | hooni | 2003.04.23 | 12608 |
68 | System/OS | [linux] 간단한 find 명령어 설명(업데이트 해야 함) | hooni | 2013.04.23 | 9111 |
67 | System/OS | [linux] yum 업데이트 시 커널 제외하기 | hooni | 2014.09.11 | 1266 |
66 | System/OS | [linux] X환경 GNOME에서 KDE로 바꾸는 법.. | hooni | 2013.04.23 | 12367 |
65 | System/OS | [linux] Xwindow/Xmanager 사용 | hooni | 2003.04.23 | 13344 |
64 | System/OS | [linux] wget 명령 사용 예제 | hooni | 2020.05.26 | 1450 |
63 | System/OS | [linux] vi 편집기 간단한 명령과 환경설정 | hooni | 2003.04.23 | 11360 |
62 | System/OS | [linux] The Ultimate Wget Download Guide With 15 Awesome Examples | hooni | 2020.05.26 | 812 |
61 | System/OS | [linux] ssh에서 원격 파일 전송하기.. | hooni | 2013.04.23 | 14161 |
60 | System/OS | [linux] SSH에 대한 기본 설명과 설치/설정 | hooni | 2013.04.23 | 10503 |
59 | System/OS | [linux] split 명령어 | hooni | 2014.03.11 | 4309 |