Today, I will try to get the follower list in 4 lines.
However, I only use the usual Twittroauth, but if you do not have abraham / twitteroauth, please do so from Composer.
composer require abraham/twitteroauth
The API limit is 5000 per user. If you want to get more, you can loop with "for". Note that oauth_token and oauth_token_secret are not required and can be accessed.
For details ↓
TwitterDev Official Reference
Get list of follower
require 'vendor/autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth("APIKey", "APISecret");
$followers = $connection->get("followers/list",array('cursor' => '-1', 'screen_name' => 'screen_name','count'=>'100'));
Simply
- Auto loading
- Namespace import
- Credential settings & instantiation
- Get
that's all.
Information is returned as a class object
Get list of Follow
Just change followers/list
on the 4th line to friends/list
.
Thanks.
My Website
Twitter@tomox0115
Top comments (0)