BR
asked on
PHP json object
Dear Experts,
I use PHP,
I need to get a result inside an object which is inside Json.
I get the parrent result like below.
But I need to result of the ReturnCode information.
How can I get that? thank you
I use PHP,
I need to get a result inside an object which is inside Json.
I get the parrent result like below.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
var_dump ( $obj = json_decode($server_output));
echo $yeniobj= ($obj->result);
//Result is
object(stdClass)#1 (10) { ["result"]=> string(90) "{"ReturnCode":0,"ReturnData":null,"Confirm":null,"TimeStamp":"04.11.2019 10:43:34"}" ["id"]=> int(135) ["exception"]=> NULL ["status"]=> int(5) ["isCanceled"]=> bool(false) ["isCompleted"]=> bool(true) ["isCompletedSuccessfully"]=> bool(true) ["creationOptions"]=> int(0) ["asyncState"]=> NULL ["isFaulted"]=> bool(false) }
echo $yeniobj= ($obj->result);
//Result is
{"ReturnCode":0,"ReturnData":null,"PaymentConfirm":null,"TimeStamp":"04.11.2019 10:43:34"}
But I need to result of the ReturnCode information.
How can I get that? thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Experts,
when I do this, the result is below...
echo $yeniobj= ($obj->result);
echo $ReturnCode = $yeniobj["ReturnCode"];
var_dump ($ReturnCode);
When I do that, the result is :
{string(1) "{"
when I do this, the result is below...
echo $yeniobj= ($obj->result);
echo $ReturnCode = $yeniobj["ReturnCode"];
var_dump ($ReturnCode);
When I do that, the result is :
{string(1) "{"
You're using leakim971's code. It does not work!
ASKER
Thank you so much Brian Tao
Open in new window