android - Decode Json Object from a url in php coming from a user -


hey making android app user's request in format of json . request this..

  jsonobject j = new jsonobject(createjson());           string  url ="http://codemoirai.esy.es/test.php?userdetails="+j;    j = {"email":"code@gmail.com","username":"xyz","password":"xyz"} 

this sending test.php , want know how can fetch data , display using php.

  <?php require "init1.php";    $jsonobject = $_get["userdetails"]; $obj = json_decode($jsonobject); $email = $obj->email;  $password = $obj->password; .......   echo $email; //everthing fetch jsonobject null. why?   ?> 

thankyou, correct how fetching in php??

in test.php can catch data $_get['userdetails'] decode json_decode($_get['userdetails')

then can iterate foreach loop

example:

if(isset($_get['userdetails'])) {      $details = json_decode($_get['userdetails']);        foreach($details $key => $val) {            echo $key.' = '.$val;       } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -