System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
Views 3482 Comment 1
Attachment '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
-
?
NameValuePair는 안드로이드 스튜디오에서는 Deplicate 걸렸어요~ 다른걸로 대체하심이 ..
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
1077 | System/OS | [linux] ipchains 사용예(패킷 필터링) | hooni | 2003.04.23 | 14179 |
1076 | System/OS | [linux] ipfwadm를 이용한 패킷필터링(구버전) | hooni | 2003.04.23 | 13023 |
1075 | System/OS | [windows] 98/ME 속도 빠르게 튜닝(부팅,메모리,레지스터) | hooni | 2003.04.23 | 50447 |
1074 | System/OS | [windows] 도스 사용 팁 | hooni | 2003.04.23 | 17814 |
1073 | System/OS | [windows] 여러가지 활용 팁 | hooni | 2003.04.23 | 19977 |
1072 | System/OS | [windows] 배치(bat)파일 제작 방법 | hooni | 2003.04.23 | 17010 |
1071 | System/OS | [linux] 패킷 스니퍼링 | hooni | 2003.04.23 | 16323 |
1070 | System/OS | [linux] 패킷의 소스 주소 바꾸기 | hooni | 2003.04.23 | 18792 |
1069 | System/OS | [linux] iptables 명령어 매뉴얼(options) | hooni | 2003.04.23 | 11342 |
1068 | System/OS | [linux] 간단한 NAT 설정 script | hooni | 2003.04.23 | 12606 |
1067 | System/OS | [linux] 랜카드 2개 설정 & iptables 로 사설 ip.. | hooni | 2003.04.23 | 14741 |
1066 | System/OS | [linux] apache, php, jsp 환경설정하기.. | hooni | 2003.04.23 | 15244 |