YesYo.com MintState Forums
뒤로    YesYo.com MintState BBS > Tech > Android
검색
멤버이름    오토
비밀번호 
 

HttpPost (POST 방식으로 파라메터 넘기기)

페이지 정보

작성자 MintState 댓글 0건 조회 11,309회 작성일 11-03-31 11:57

본문

HttpPost (POST 방식으로 파라메터 넘기기)

Executing a HTTP POST Request with HttpClient

public void postData() {
	// Create a new HttpClient and Post Header
	HttpClient httpclient = new DefaultHttpClient();
	HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php");
	try {
		// Add your data
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
		nameValuePairs.add(new BasicNameValuePair("id", "12345"));
		nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
		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
	}
} 

댓글목록

등록된 댓글이 없습니다.

Total 18건 1 페이지
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™