i been trying to extract data from json with the following format:
[{"_type":"pipe","time":"2013-10-25 02:42:51","1_price":["00.00"],"1_name":["name"],"_template":"675fgy","1_purl":["http://"],"_cached_page_id":"te487","1_image":["image.jpeg"],"url":"http://"},
[{"_type":"pipe","time":"2013-10-25 02:42:55","1_price":["00.00"],"1_name":["name"],"_template":"16778f","1_purl":["http://"],"_cached_page_id":"456gt","1_image":["image.jpeg"],"url":"http://"},
my following code returns "Array2013-10-25 02:42:51" ie. it only returns the value of "time" cant seem to get the value "1_name"
please tell me what im doing wrong
$url = "http://.../api.output";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
$arr = json_decode($result, true);
foreach($arr as $val)
{
echo $val['1_name'];
echo $val['time'];
}