我可以很容易地使用PHP和JSON获取用户推文,但只要我用它来获取关注者列表,就会收到错误信息。两者都使用JSON来返回值。在PHP中使用JSON获取Twitter追随者?
的代码是:
$jsonurl = "https://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=mooinooicat";
$contents = file_get_contents($jsonurl);
$results = json_decode($contents, true);
echo "<pre>";
print_r($results);
echo "</pre>";
这给了我下面的数组:
Array
(
[next_cursor] => 0
[ids] => Array
(
[0] => 31085924
[1] => 53633023
[2] => 18263583
)
[previous_cursor] => 0
[next_cursor_str] => 0
[previous_cursor_str] => 0
)
如何获得next_cursor和previous_cursor的价值观和我怎么循环刚刚经历的ID阵列?
我想解析读取到数据库中的结果。
看看http://php.net/manual/en/language.types.array.php – 2012-01-31 11:36:46
@andrebruton https://api.twitter.com/1/followers/ids.json它向我们提供了我提供的屏幕名称追随者的ID,我们可以替换屏幕名称吗? – 2012-07-30 23:57:22
请参阅:[Twitter追随者API教程](https://dev.twitter.com/rest/reference/get/followers/ids) – kenorb 2015-05-30 22:45:41