Twitter::loadUserFollowers PHP Method

loadUserFollowers() public method

Returns IDs of followers of a given user.
public loadUserFollowers ( $username, $count = 5000, $cursor, $cacheExpiry = null ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/get/followers/ids
    public function loadUserFollowers($username, $count = 5000, $cursor = -1, $cacheExpiry = null)
    {
        return $this->cachedRequest('followers/ids', ['screen_name' => $username, 'count' => $count, 'cursor' => $cursor], $cacheExpiry);
    }

Usage Example

Example #1
0
} catch (TwitterException $e) {
    echo "Error searching Twitter: ", $e->getMessage();
}
try {
    $statuses = $twitter->request('statuses/retweets_of_me', 'GET', array('count' => 20));
    foreach ($statuses as $status) {
        echo "message: ", $status->text;
        echo "posted at ", $status->created_at;
        echo "posted by ", $status->form_user;
    }
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error getting statuses from Twitter: ", $e->getMessage();
}
try {
    $results = $twitter->loadUserFollowers('matthew101HS');
    foreach ($results as $result) {
        echo "message: ", $result->text;
        echo "posted at ", $result->created_at;
        echo "posted by ", $result->form_user;
    }
} catch (TwitterException $e) {
    echo "Error loading followers from Twitter: ", $e->getMessage();
}
try {
    $twitter->request('direct_messages/new', 'POST', array('screen_name' => 'matthew101', 'text' => 'hello'));
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error posting DM to Twitter: ", $e->getMessage();
}
?>