【问题标题】:Get friends ids list in twitter API with TwitterOAuth使用 TwitterOAuth 在 twitter API 中获取好友 ID 列表
【发布时间】:2016-07-21 00:59:52
【问题描述】:

我在获取 Twitter 用户的朋友列表时遇到了一些问题,我使用 TwitterOAuth 库。

$oConnection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
$armFollow = array();
foreach($_POST['user'] as $nUsrId) {
    $armFollowList = $oConnection->get("friends/ids", ["user_id " => $nUsrId]);
    $armFollow[$nUsrId] = $armFollowList->ids;
}
var_dump($armFollow);

$_POST['user'] 是一个用户 ID 数组。 当我使用此代码时,我只会得到我的帐户好友列表,即使 user_id 发送的不是我的。

感谢您的帮助 ^^(抱歉我的英语不好)

【问题讨论】:

    标签: php twitter


    【解决方案1】:

    我找到了问题。

    要获取其他用户的好友/ID,身份验证必须仅限应用程序。 (见https://dev.twitter.com/oauth/application-only

    所以我使用此代码 (https://gist.github.com/lgladdy/5141615),现在它可以工作了。

    【讨论】:

      猜你喜欢
      • 2013-06-22
      • 1970-01-01
      • 1970-01-01
      • 2011-12-12
      • 1970-01-01
      • 1970-01-01
      • 2013-08-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多