System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 3640 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
82 | System/OS | [linux] 리눅스 파일시스템과 디렉토리 설명 | hooni | 2013.04.23 | 26935 |
81 | System/OS | [linux] 랜카드가 2개 일 때 네트워크 설정 | hooni | 2003.04.23 | 30126 |
80 | System/OS | [linux] 랜카드 2개 설정 & iptables 로 사설 ip.. | hooni | 2003.04.23 | 14782 |
79 | System/OS | [linux] 데스크탑환경(GNOME/KDE) 바꾸기.. | hooni | 2003.04.23 | 12208 |
78 | System/OS | [linux] 데비안(debian.org) 리눅스 명령어 예제 | hooni | 2006.04.23 | 10513 |
77 | System/OS | [linux] 네트웍 트래픽 모니터링(MRTG) | hooni | 2003.04.23 | 42366 |
76 | System/OS | [linux] 네트워크 커널 설정.. | hooni | 2003.04.23 | 16549 |
75 | System/OS |
[linux] 꿀통(honeyd) 설치하기.. 메뉴얼 과정
6 ![]() |
hooni | 2006.04.23 | 20302 |
74 | System/OS | [linux] 기존 환경설정 저장하면서 커널 컴파일.. | hooni | 2003.04.23 | 13530 |
73 | System/OS | [linux] 기본적인 설정하기(내공쌓기) | hooni | 2003.04.23 | 14056 |
72 | System/OS | [linux] 기본 명령어 (내공쌓기) | hooni | 2003.04.23 | 14380 |
71 | System/OS | [linux] 계정관리하기(내공쌓기) | hooni | 2003.04.23 | 13315 |