mercredi 13 septembre 2017

twitter with laravel loop in same tweets

this is 3rd time I asked same questions still no answer

I'm dealing with twitter api in laravel 5.4 to get favorites I could get 200 likes but when I go through loop it's re appear the same 200 until finish limit this is my code

public function likes() 
{ 
    $contents = array();
    $limit = 1000;
    $max_id = -1;
    for($count=100 ; $count < $limit ; $count++)
    {
        if(null !== $max_id && $max_id == ''){
            break;
        }

        $content = Twitter::getFavorites([
            'count'=>$count,'screen_name'=>'k.s.a95','cursor'=>$max_id,'format'=>'array'
        ]);

        $contents[] = (array)$content;

        //$max_id = $content[count($content) - 1]['id_str'];
        if(count($content))
        {
            $last_tweet = end($content);
            $max_id = $last_tweet['id_str'];
            dd($content);
        } else $max_id = null;

    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire