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] apache, php, jsp 환경설정하기.. hooni 2003.04.23 15232
169 System/OS [linux] APM(apache, php, mysql) + gd 설치순서.. hooni 2003.04.23 18851
168 System/OS [linux] awk 명령어 hooni 2014.03.11 4955
167 System/OS [linux] CentOS 6.5 에서 "Bringing up interface eth0: Determining if ip address 121.78.127.197 is already in use for device eth0..." hooni 2014.04.05 4838
166 System/OS [linux] CentOS 6.x Cati 설치 (yum) hooni 2014.01.17 48594
165 System/OS [linux] CentOS Apache Httpd에 https 적용 hooni 2014.03.05 4478
164 System/OS [linux] CentOS 에 APM 설치하기 hooni 2015.01.02 1688
163 System/OS [linux] CentOS 터미널 언어 설정(한글/영어) hooni 2013.12.22 18513
162 System/OS [linux] DHCP(Dynamic Host Configuration Protocol) 서버 hooni 2003.04.23 13023
161 System/OS [linux] DNS(Domain Name System) 설치, 설정 hooni 2003.04.23 12438
160 System/OS [linux] GD 라이브러리 설치 방법.. file hooni 2013.04.23 11370
159 System/OS [linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기 file hooni 2014.01.09 12219
158 System/OS [linux] ipchains 사용예(패킷 필터링) hooni 2003.04.23 14171
157 System/OS [linux] ipchains 옵션 hooni 2003.04.23 13611
156 System/OS [linux] ipfwadm를 이용한 패킷필터링(구버전) hooni 2003.04.23 13015
155 System/OS [linux] iptables 명령어 매뉴얼(options) hooni 2003.04.23 11335
Board Pagination Prev 1 2 3 4 5 ... 13 Next
/ 13