I'm just trying to figure out to what is the best possible way to compute with the data coming from twitter. I have a problem at my hand,
With that find the n number of retweeters of each tweet.
if(isset($_GET['handle'])){
$tweets = $connection->get('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name='.$_GET['handle'].'&result_type=recent&count=20');
$data['ex'] = $tweets;
$data['tweet'] = array();
$data['tweeters'] = array();
foreach ($tweets as $tweet) {
array_push($data['tweet'],$tweet->id_str);
}
var_dump($data['tweet']);
foreach ($data['tweet'] as $tweters) {
$retweeters_ids = $connection->get('https://api.twitter.com/1.1/statuses/retweeters/ids.json?id='. $tweters .'&count=10');
var_dump($retweeters_ids);
}
}
i know the above code is bad because i can't put a get request inside foreach. So, if someone has a better a way to solve this issue. Rate limit was problem i figured out after trying to do.
I do this with separate scripts that run in separate moments (otherwise I hit the rate limits).