How to write PHP to receive JSON from Android -


how write php (server side) receive json insert db using android.

i wrote java send data php server :

    httppost httppost = new httppost("http://sit-edu4.sit.kmutt.ac.th/csc498/51270372/[my folder].[my filename].php"); 

but not know how write php file receive json insert db.

could please me ? thank you.

you have json data somewhere in $_post array.

you can decode json this:

$json = $_post['data']; // replace 'data' key $decoded = json_decode($json, true); if ($decoded === false) {   throw new exception('bad json format.'); } // save database via pdo 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -