Contents

Views 3659 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


?

List of Articles
No. Category Subject Author Date Views
105 Develop [ios] NSString, RegularExpression Find/Replace hooni 2017.04.14 964
104 Develop [ios] Facebook SDK 로그인 설명 file hooni 2017.04.19 1367
103 Etc 사이버보안실무 시험. secret hooni 2017.04.20 0
102 Develop [ios] 코코아 프로그래밍의 네이밍 룰(명명 규칙) hooni 2017.05.11 1295
101 Develop 리팩토링 계획안 file hooni 2017.05.15 884
100 System/OS [windows] 윈도우즈 콘솔에서 정품인증 하는 방법 hooni 2017.05.24 5684
99 Develop 사이버보안실무 발표자료 (2017.06.08) file hooni 2017.06.05 1371
98 Develop 캘리포니아 운전면허 족보 file hooni 2017.06.12 896
97 Develop [android] 간단한 SQLIite 예제 hooni 2017.06.14 1478
96 Develop [android] SQLiteOpenHelper를 이용한 DBManager hooni 2017.06.14 2198
95 Etc IT감사 기법 시험 file hooni 2017.06.14 1635
94 Develop [coding] Find all anagrams in a string hooni 2017.06.27 1306
Board Pagination Prev 1 ... 85 86 87 88 89 90 91 92 93 94 ... 98 Next
/ 98