good evening. ingore all other elements, I want get first image in each foreach. how to?
$data = json_decode($json,true);
foreach ($data['data'][0] as $image) {
echo '<img src="'.$image['images'][0]['source'][0].'" />';
}
json tree is too large, over the letters paste limit.
Oops! Your question couldn't be submitted because:
body is limited to 30000 characters; you entered 68494
so here is the url u can get the json tree https://graph.facebook.com/5550296508/photos
and u can paste in http://jsonlint.com/ look the struction well. Thanx.
With
json_decodeevery{}(object) will become anobject(stdClass)and every[](array) will become anarray. So:is what you need, to reach the first image source.
Edit: since the second parameter of
json_decodeistrue, it will become an associative array, and it will be like:To get all the images: