Views 3448 Votes 0 Comment 1
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

라이브러리 안 쓰고 간단한 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

?
  • ?
    ㄴㄴ 2017.05.04 17:02
    NameValuePair는 안드로이드 스튜디오에서는 Deplicate 걸렸어요~ 다른걸로 대체하심이 ..

List of Articles
No. Category Subject Author Date Views
170 System/OS [linux] 꿀통(honeyd) 설치하기.. 메뉴얼 과정 6 file hooni 2006.04.23 20219
169 System/OS [windows] 여러가지 활용 팁 hooni 2003.04.23 19969
168 System/OS 나중에 해봐야지.. libconv 설치.. ㅡ,.ㅡ; hooni 2013.04.23 19284
167 System/OS [mysql] MySQL server has gone away 에러 대응 hooni 2013.05.29 19224
166 System/OS [linux] APM(apache, php, mysql) + gd 설치순서.. hooni 2003.04.23 18851
165 System/OS [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리 hooni 2013.07.10 18797
164 System/OS [linux] 패킷의 소스 주소 바꾸기 hooni 2003.04.23 18784
163 System/OS [linux] CentOS 터미널 언어 설정(한글/영어) hooni 2013.12.22 18513
162 System/OS 해커스랩 깨기.. 후후.. ㅋㅋ file hooni 2013.04.23 18413
161 System/OS NAT와 DHCP에 대한 간단한 설명 hooni 2013.04.23 18328
160 System/OS [windows] 인터넷 익스플로러(IE) 도구모음 표시줄에 아이콘 추가 file hooni 2013.04.23 18219
159 System/OS [bios] 시스템 부팅 도중 발생하는 비프음 hooni 2003.04.23 18158
158 System/OS [windows] 종료, 재시작, 로그아웃 아이콘 만들기 hooni 2013.04.23 18102
157 System/OS [web] 웹서비스 취약점 자료.. (논문첨부) file hooni 2003.04.23 17940
156 System/OS [linux] 리눅스,유닉스 /proc/stat 파일 보는 법 hooni 2013.04.23 17916
155 System/OS [linux] 커널 컴파일, 설정 hooni 2003.04.23 17845
Board Pagination Prev 1 2 3 4 5 ... 13 Next
/ 13