System/OS
2017.02.16 16:15
[android] 초간단 HTTP, POST 전송 샘플
조회 수 3645 댓글 1
첨부 '1' |
|
---|
라이브러리 안 쓰고 간단한 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
-
[windows] 최근 열어본 문서목록 안나오게 하는 방법
-
[java] Tomcat/UTF-8 or All 지원 ㅎㅎ
-
[mac] OSX(맥) 단축키 설명 ㅎㅎ
-
[mac] 맥(OSX)에서 root 패스워드 설정하기
-
[mac] 맥에서 APM(apache,php,mysql) 구성하기
-
[sql] insert into select 사용하기
-
[doc] 코코아 프로그래밍 for MACOS 관련 내 분량..
-
맥북에서 MAC/윈도우 멀티부팅시 시간 설정
-
맥에서 파일공유 (윈도우,맥)
-
[mysql] mysql user 생성시 ERROR 1364
-
Mac OS X - Apache+PHP+MySQL 환경 서버
-
[mysql] MySQL server has gone away 에러 대응