Views 3449 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] 아파치설치/설정 - 알리어싱(aliasing) hooni 2003.04.23 51368
169 System/OS [linux] 랜카드가 2개 일 때 네트워크 설정 hooni 2003.04.23 30015
168 System/OS [linux] 텔넷, FTP 텍스트 모드에서 사용 hooni 2003.04.23 11939
167 System/OS [linux] 이기종간의 파일 공유(Samba) hooni 2003.04.23 14900
166 System/OS [linux] sendmail 설정/사용 hooni 2003.04.23 14570
165 System/OS [linux] DNS(Domain Name System) 설치, 설정 hooni 2003.04.23 12438
164 System/OS [linux] Masquerade 가상 ip분할기법 hooni 2003.04.23 47936
163 System/OS [linux] DHCP(Dynamic Host Configuration Protocol) 서버 hooni 2003.04.23 13023
162 System/OS [linux] 네트웍 트래픽 모니터링(MRTG) hooni 2003.04.23 41778
161 System/OS [linux] 커널 컴파일, 설정 hooni 2003.04.23 17845
160 System/OS [linux] 네트워크 커널 설정.. hooni 2003.04.23 16470
159 System/OS [linux] 최소한의 커널 설정(커널설치 전체과정) hooni 2003.04.23 17395
158 System/OS [linux] Xwindow/Xmanager 사용 hooni 2003.04.23 13332
157 System/OS [linux] ipchains 옵션 hooni 2003.04.23 13611
156 System/OS [linux] ipchains 사용예(패킷 필터링) hooni 2003.04.23 14171
155 System/OS [linux] ipfwadm를 이용한 패킷필터링(구버전) hooni 2003.04.23 13015
Board Pagination Prev 1 2 3 4 5 ... 13 Next
/ 13