im crating an android app that can connect to sql server database via php. The thing is i dont know how to pass parameter from android to PHP. I have search for tutorial about this thing, and there is many, but all of them using HttpClient, HttpPost, and NameValuePairs that already deprecated (?) and cant be used anymore. Can someonoe tell me how to pass parameter like this to PHP?
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
nameValuePairList.add(new BasicNameValuePair("name", name));
nameValuePairList.add(new BasicNameValuePair("email", email));
nameValuePairList.add(new BasicNameValuePair("phone", phone));
try{
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairList));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
etName.setText("");
etEmail.setText("");
etPhone.setText("");
Toast.makeText(getApplicationContext(), successMessage, Toast.LENGTH_SHORT).show();
is.close();
}catch(IOException e){
Toast.makeText(getApplicationContext(), exceptionMessage, Toast.LENGTH_SHORT).show();
}
Thanks for your help