0
good afternoon. I tried to do some research here, but I couldn’t find what I needed. I am working with JSON, and received the following return string:
{
"success": 1,
"return": {
"100025362": {
"pair": "BRL",
"type": "sell",
"amount": 21.615,
"rate": 0.258,
"timestamp_created": 1418654530,
"status": 0
},
...
}
}
This number 100025362
, is an open order that I own.
But at the time of this JSON consultation, I do not have the order number.
I would need to run all orders, to get the status.
If I had the order number, I’d be fine, I’d be:
$json_ActiveOrder = json_decode($stringJSON);
$ActiveOrderStatus = $json_ActiveOrder->return->100025362->status;
But as I do not have access to the number at this time, how would I run all orders? In case 100025362
??
I tried to receive only until return
, and loop, but I have the following errors with the code below:
$json_ActiveOrder = json_decode($retorno_ActiveOrder);
$ActiveOrder = $json_ActiveOrder->return;
foreach($ActiveOrder as $f) {
echo $f[0];
}
The mistake comes out:
( ! ) Notice: Undefined property: stdClass::$return in C:\wamp\www\bitcoin\index.php on line 132
Call Stack
# Time Memory Function Location
1 0.0000 149328 {main}( ) ..\index.php:0
( ! ) Warning: Invalid argument supplied for foreach() in C:\wamp\www\bitcoin\index.php on line 134
Call Stack
# Time Memory Function Location
1 0.0000 149328 {main}( ) ..\index.php:0
you would just like to catch the number "100025362" ?
– RFL
Yeah, I’d just like to take this number!!
– Marcio Souza
have tried
$x = json_decode($stringJSON, true);
and then$x['return'][0]
?– RFL