Get user follower count with 1.1 - 410 Gone

前端 未结 3 1585
暖寄归人
暖寄归人 2021-01-14 21:52

I\'m trying to build a \'Follow\' button with a vertical followers count above it. I had a solution working until Twitter retired the 1.0 API today and now require an Oauth

3条回答
  •  野的像风
    2021-01-14 22:09

    i follow this step.and to get twitter follower count

    use this code

    $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
    $getfield = '?screen_name=Android';
    $requestMethod = 'GET';
    $twitter = new TwitterAPIExchange($settings);
    $follow_count=$twitter->setGetfield($getfield)
                 ->buildOauth($url, $requestMethod)
                 ->performRequest();
                $testCount = json_decode($follow_count, true);
    echo "
    ";
    echo $testCount[0]['user']['followers_count'];
    echo "
    ";

    you can change the "screen_name" and get the follower count.

    cheers.

提交回复
热议问题