Contents

조회 수 3640 댓글 1
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

라이브러리 안 쓰고 간단한 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
번호 분류 제목 글쓴이 날짜 조회 수
82 System/OS 라우팅 경로 결정 영향 요소 ㅋㅋ file hooni 2013.04.23 15942
81 System/OS OSI (Open Systems Interconnection) 개방형 시스템간 상호 접속 file hooni 2013.04.23 10848
80 System/OS 네트워크별 MTU(최대 전송 단위) hooni 2013.04.23 17711
79 System/OS [router] 라우팅 프로토콜 BGP (간단한 세팅) hooni 2013.04.23 11010
78 System/OS [router] 시스코 라우터 명령어 모드.. hooni 2013.04.23 13009
77 System/OS [mysql] 시간 관련 SQL구문.. hooni 2013.04.23 10875
76 System/OS [linux] 데비안(debian.org) 리눅스 명령어 예제 hooni 2006.04.23 10513
75 System/OS [linux] 꿀통(honeyd) 설치하기.. 메뉴얼 과정 6 file hooni 2006.04.23 20302
74 System/OS [web] 웹서비스 취약점 자료.. (논문첨부) file hooni 2003.04.23 18060
73 System/OS [linux] man 명령어 뽀개기.. hooni 2003.04.23 8778
72 System/OS [linux] root도 삭제하지 못하는 파일 속성 hooni 2003.04.23 12458
71 System/OS [linux] 터미널에서 문자 깨질 때 설정 ㅋㅋ hooni 2003.04.23 13965
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 ... 17 Next
/ 17