我已经在这个 SoundCloud 网站上工作了一段时间,并且刚开始创建一个将在我们的网站上显示的流页面替代方案。我偶然发现了一个问题,我确信这是一个简单的解决方案,我现在只是弄清楚2如何实现正确的输出。
$user_ID = $_GET['id'];
$sc = curl_init();
curl_setopt($sc, CURLOPT_URL, 'http://api.soundcloud.com/users/'.$user_ID.'/followings?client_id='.$client_ID.'&page_size=200&cursor=1419617528000');
curl_setopt($sc, CURLOPT_HEADER, 0);
curl_setopt($sc, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($sc);
curl_close($sc);
$content = json_decode($output, true);
正如您在上面所看到的,当前代码最多可以显示400个用户正在关注的用户,但是当我们执行以下操作时,2将返回该链接上显示的所有内容。
echo "<pre>";
print_r($content);
echo "</pre>";
它似乎只有200个结果(,这真的不是那么好,我们需要2找到替代2显示有人正在关注的全部用户。)在页面底部它显示另一条消息。
[199] => Array
(
[avatar_url] => http://a1.sndcdn.com/images/default_avatar_large.png?1485508269
[id] => 72067899
[kind] => user
[permalink_url] => http://soundcloud.com/berthalie30
[uri] => https://api.soundcloud.com/users/72067899
[username] => berthalie30
[permalink] => berthalie30
[last_modified] => 2016/04/06 21:53:03 +0000
[first_name] =>
[last_name] =>
[full_name] =>
[city] =>
[description] =>
[country] =>
[track_count] => 0
[public_favorites_count] => 0
[followers_count] => 21
[followings_count] => 89
[plan] => Free
[myspace_name] =>
[discogs_name] =>
[website_title] =>
[website] =>
[reposts_count] => 32
[comments_count] => 0
[online] =>
[likes_count] => 0
[playlist_count] => 6
)
)
[next_href] => https://api.soundcloud.com/users/24537746/followings?client_id=XXXX&page_size=200&cursor=1406526915000
然而,即使使用此方法也不会做任何事情(即使我更确定我正在测试的用户有超过200个用户,他正在关注。)
编辑:有人http://prnt.sc/e197g9遇到了同样的问题,但我怎么理解有关2如何阻止它发生的评论解决方案..