php - Instagram API : Get Integer from JSON -
this question has answer here:
- how extract data json php? 2 answers
using code can id fine, can't figure out how integer part of array, example follows
value:
$result = file_get_contents("https://api.instagram.com/v1/users/1234/?access_token={token}"); $obj = json_decode($result); echo $obj->data->id;
instagram json example:
object(stdclass)#1 (2) { ["meta"]=> object(stdclass)#2 (1) { ["code"]=> int(200) } ["data"]=> object(stdclass)#3 (7) { ["username"]=> string(6) "testy" ["bio"]=> string(51) "blah blah" ["website"]=> string(26) "http://domain.com" ["profile_picture"]=> string(110) "https://scontent.cdninstagram.com/hphotos-xfa1/some.jpg" ["full_name"]=> string(16) "my testy" ["counts"]=> object(stdclass)#4 (3) { ["media"]=> int(141) ["followed_by"]=> int(23900) ["follows"]=> int(184) } ["id"]=> string(4) "1234" } }
how construct line follows integer value?
echo $obj->data->follows;
echo $obj->data->counts->follows;
Comments
Post a Comment