mardi 6 février 2018

loop in twitter api laravel 5

I'm trying to get all likes by auth user. first I get user favorite_count. then I start looping . at the end I get id_str from last item in loop to get new collections. is it right way ? I'm getting error '[88] Rate limit exceeded'

this is my code

$fav =  Twitter::getUserTimeline(['count' => 1, 'format' => 'array']);
    $count = $fav[0]['user']['favourites_count'];
    $tweets =  Twitter::getFavorites(['screen_name' => 'test', 'count' => 200 , 'format' => 'array']);

    for($i=0;$i<$count;$i++){
        echo $tweets[$i]['text'];
        echo '</br>';
        $end = end($tweets);
        $val = $end['id_str'];
        $tweets = Twitter::getFavorites(['screen_name' => 'test', 'count' => 200 ,'max_id' => $val, 'format' => 'array']);
    }

*fav_count = 1136



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire