【问题标题】:How can i get twitter follower ids?我如何获得 Twitter 关注者 ID?
【发布时间】:2012-12-12 19:44:37
【问题描述】:

当点击这个https://api.twitter.com/1/followers/ids.json?screen_name=USER_NAME

返回;

{"ids":[XXXXXXXXXXX,XXXXXXXXXXXX,XXXXXXXXXXX,.........],"next_cursor":0,"next_cursor_str":"0","previous_cursor":0,"previous_cursor_str":"0"}

我怎样才能将这些 id 保存到 PHP 上的数组中?

【问题讨论】:

    标签: php json twitter


    【解决方案1】:
    $data = file_get_contents("https://api.twitter.com/1/followers/ids.json?screen_name=$USER_NAME");
    $array = json_decode($data, true);
    if (isset($array['ids']) && is_array($array['ids']) {
        $idsArray = $array['ids'];
        var_dump($idsArray); // that is the array you need
    } else {
        die('Data format error');
    }
    

    【讨论】:

      猜你喜欢
      • 2014-02-11
      • 2011-08-23
      • 2013-08-28
      • 2011-09-20
      • 2014-06-18
      • 1970-01-01
      • 2021-05-22
      • 2015-06-20
      • 2014-06-08
      相关资源
      最近更新 更多