简体   繁体   English

Zend_service_twitter和关注者列表

[英]Zend_service_twitter and the list of followers

I'm developing an application where I sign in using twitter and OAuth. 我正在开发一个使用Twitter和OAuth登录的应用程序。 I'm using Zend_OAuth and the zend_service_twitter classes. 我正在使用Zend_OAuthzend_service_twitter类。 The problem is that I want to collect the list of all my followers but when i use the userFriends() or the userFollowers() methods I only get the last 100 users following me, even if I pass the page parametre to the functions. 问题是我想收集所有关注者的列表,但是当我使用userFriends()userFollowers()方法时,即使我将页面参数传递给函数,我也只能得到最近的100个用户。

I would like to find a way to get all of my followers or at least be able to paginate them 100 by 100 or something like this. 我想找到一种方法来吸引我的所有关注者,或者至少能够将他们100个100个分页或类似的内容。

Accordingly the offical documentation, you can pass page parameter to the method: 相应地,官方文档,您可以将page参数传递给方法:

The followers() method accepts an array of optional parameters to modify the query. followers()方法接受可选参数数组以修改查询。

id specifies the ID or screen name of the user for whom to return a list of followers. id指定要为其返回关注者列表的用户的ID或屏幕名称。

page specifies which page you want to return. 页面指​​定您要返回的页面。

So i should be something like this: 所以我应该是这样的:

$user->followers(array("page" => 1));

EDIT: 编辑:

As I also had this problem and couldn't really figure out why the pagination didn't work, i used a solution like this: 由于我也遇到了这个问题,无法真正弄清为什么分页不起作用,我使用了以下解决方案:

$twitter_url =  'https://api.twitter.com/1/users/show.json?user_id='. $userTwitterId;
$response = json_decode(file_get_contents($twitter_url));
$followrs = $response['followers_count'];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM