안드로이드/Http
Android HttpPost
설.현.아빠
2011. 2. 17. 16:52
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("mb_id", "id"));
nameValuePairs.add(new BasicNameValuePair("mb_name", "name"));
nameValuePairs.add(new BasicNameValuePair("mb_nick", "nick"));
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.***.***/login.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,HTTP.UTF_8));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
Log.i("POST_True","");
}
catch(Exception e)
{
Log.e("POST_Fail", e.toString());
}