Hi i am trying to fetch single value from below Array example -
i want to fetch order_id and name -
<?php
$url = 'http://example.com/index.php?route=feed/rest_api/orders&key=test219';
$json = file_get_contents($url);
echo '<pre>'; echo $json; echo '</pre>';
?>
Array showing
Array
(
[0] => Array
(
[order_id] => 6
[name] => zoraya panansar
[status] => Complete
[date_added] => 2014-01-24 23:06:09
[products] => 4
[total] => 14.8000
[address_1] => 345 goldhawk road
[address_2] => hammersmith
[city] => london
[Postcode] => w6 0wz
[Country] => United Kingdom
[Email] => [email protected]
[Tele.] => 0786870150
)
I already tried
echo $json->order_id;
and
echo $json[0]['order_id'];
but its not working... Please help
json_decode($json)?file_get_contents. so you cannot accessorder_idfrom$json