0

I already checked previous all thread but no luck.

I am getting json response like this: http://pastebin.com/HS0UhYat for var_dump($tweets5);

code:

//$tweetid = "200582436";
$tweets5 = $connection->get("https://api.twitter.com/1.1/statuses/retweets/".$tweetid.".json?count=1");
var_dump($tweets5);
$tweets5 = json_decode($tweets5,true);
echo $tweets5[retweeted_status][user][name];
echo $tweets5->retweeted_status->user->name;
echo "$tweets5<br><br>";

I want to get each value username, id etc seperately. how to to this?

1 Answer 1

1

you can use a simple foreach on your json object:

foreach($tweets5[0] as $tweet) {
    echo $tweet['user']['name'];
}
Sign up to request clarification or add additional context in comments.

2 Comments

still no luck, even echo $tweet['retweeted_status']['user']['name']; does not display any result
looking better at your dump, maybe you have to cycle on $tweets5[0], not on $tweets5

Your Answer

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