1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://vieilleip/changeip");
// Création du ou des paramètres
ArrayList<NameValuePair> nameValuePair = new ArrayList<NameValuePair>();
nameValuePair.add(new BasicNameValuePair("ip", "192.168.1.1"));
// Encodage des paramètres
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// Envoi de la requête
try {
HttpResponse reponse = httpClient.execute(httpPost);
Log.d("Reponse:", reponse.toString());
} catch (Exception e) {
e.printStackTrace();
} |
Partager