System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
Views 3644 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 |
---|---|---|---|---|---|
178 | System/OS | [windows] 윈도우 사용자 계정 로그인 암호 분실, 암호 변경하는 방법 | hooni | 2015.07.09 | 21537 |
177 | System/OS | [windows] 원격 데스크탑(터미널 서비스) 포트 변경 | hooni | 2013.04.23 | 16360 |
176 | System/OS | [windows] 여러가지 활용 팁 | hooni | 2003.04.23 | 20039 |
175 | System/OS | [windows] 배치(bat)파일 제작 방법 | hooni | 2003.04.23 | 17069 |
174 | System/OS | [windows] 도스 사용 팁 | hooni | 2003.04.23 | 17900 |
173 | System/OS | [windows] 98/ME 속도 빠르게 튜닝(부팅,메모리,레지스터) | hooni | 2003.04.23 | 50533 |
172 | System/OS | [web] 웹서비스 취약점 자료.. (논문첨부) | hooni | 2003.04.23 | 18060 |
171 | System/OS | [virtualbox] VirtualBox에 Ubuntu 설치하기 | hooni | 2019.11.22 | 1068 |
170 | System/OS | [unix] 유닉스 csh에서 환경변수 등록 | hooni | 2003.04.23 | 11756 |
169 | System/OS | [unix] SUN Solaris 싱글모드.. ㅡ,.ㅡ; | hooni | 2003.04.23 | 12055 |
168 | System/OS | [unix] AIX쉘 초기 파일 (.cshrc) | hooni | 2013.04.23 | 10357 |
167 | System/OS | [switch] 시스코 카탈리스트(Cisco Catalyst) 기본 설정 | hooni | 2013.04.23 | 17570 |