I'm trying to get the number of followers, follows, tweets, etc. for a user.
I found this api call http://api.twitter.com/1/users/show.json?screen_name=barackobama
How do I take that json result 开发者_StackOverflow中文版and store it in an array?
Thanks
You can use json_decode and set the second parameter to true:
$json = file_get_contents("http://api.twitter.com/1/users/show.json?screen_name=barackobama");
$json_array = json_decode($json, true);
Of course for file_get_contents() to work with an URL, you have to have allow_url_fopen directive enabled in your php.ini.
精彩评论