httpPost방식으로 웹서버로 데이터 전송하기
퍼미션은 INTERNET
public void DataSend() {
try{
url = new URI("http://192.168.0.20:8080/testWebapp/Receive.jsp");
new Thread() {
public void run() {
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
ArrayList<BasicNameValuePair> nameValuePairs = new ArrayList<BasicNameValuePair>();
nameValuePairs.add(new BasicNameValuePair("mark_id", sendMarkId));
nameValuePairs.add(new BasicNameValuePair("store_name", sendName));
nameValuePairs.add(new BasicNameValuePair("latitude", sendLat));
nameValuePairs.add(new BasicNameValuePair("longitude", sendLng));
nameValuePairs.add(new BasicNameValuePair("comments", sendTip));
nameValuePairs.add(new BasicNameValuePair("kind", sendKind));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "utf-8"));
httpclient.execute(httpPost);
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}catch(Exception e){
Log.e("fureun",e.toString());
}
}