HttpURLConnection객체로 JSONOjbect를 Post방식으로
PHP로 넘겼는데 도무지 넘어 오지않네요...
===============================================================================안드로이드 소스코드
JSONObject result = null;
try{
URL urlCon = new URL(strUrl);
HttpURLConnection httpCon = (HttpURLConnection) urlCon.openConnection();
String json = post.toString();
httpCon.setRequestProperty("Accept", "application/json");
httpCon.setRequestProperty("Content-type", "application/json");
httpCon.setRequestProperty("Content-type","application/x-www-form-urlencoded");
httpCon.setDoOutput(true);
httpCon.setDoInput(true);
httpCon.setUseCaches(false);
httpCon.setDefaultUseCaches(false);
OutputStream os = httpCon.getOutputStream();
os.write(json.getBytes("utf-8"));
os.flush(); // 여기까지 JSONObject 값을 넘기는데 PHP $_POST에 아무것도 들어 있지 않아요
InputStream is = httpCon.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
StringBuilder strResult = new StringBuilder();
while ((line = reader.readLine()) != null)
strResult.append(line);
httpCon.disconnect();
result = new JSONObject(strResult.toString());
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
} catch (JSONException e)
{
e.printStackTrace();
}
============================================PHP 소스코드