1

单击此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 上的数组中?

4

1 回答 1

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');
}
于 2012-12-12T19:46:55.193 回答