i have a java class used for invoke php POST scripts on server, and parse response (a json message). this is code for send request and get response:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
return new JSONObject(json);
and on PHP script i get params with
$_POST['params'];
and send result with
json_encode($response_json);
now, url is a simple http. Now i would buy an ssl certificate for my server (a cloud hosting) for crypt data (sended and received).
How i should modify my android and php code for send request and read values in https? does android api automatically crypt data with ssl or not?