点击此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上的数组中?
答案 0 :(得分: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');
}