1

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 and store it in an array?

Thanks

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.