[英]Follower limit reached Instagram API using PHP
Im trying to get all my information from my Instagram profile. 我试图从我的Instagram个人资料中获取所有信息。 If i got <50 followers it displays correct. 如果我的追踪者少于50名,则显示正确。 My test profile has like 7 - 8 followers. 我的测试档案有7-8位关注者。 My real profile has like 200 followers but the max what my code is printing is 49 when limit = 0 in my functions. 我的实际个人资料有200个关注者,但是当我的函数中limit = 0时,我的代码最多可以打印49个。 When I change that limit to 25000 it prints +- 100 followers. 当我将该限制更改为25000时,它将显示+-100个关注者。 My main question is. 我的主要问题是。 How do i get the correct amount of followers when the amount is > 200. 数量> 200时如何获得正确的关注者数量。
my function: 我的功能:
public function getUserFollower($id = 'self', $limit = 25000)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/followed-by', true, $params);
}
Im Calling my Object how I'm supposed to. 我怎么称呼我的对象。 It works. 有用。
$getFollowers = $instagram->getUserFollower();
Then I'm counting my amount of followers: 然后,我计算了我的关注者数量:
echo '<b>Followers:</b> '. count($getFollowers->data).'</br>';
But the limit in this case (using my real profile) is : 96 但是在这种情况下(使用我的真实个人资料)限制为:96
do i have to use the 'pagination' from instagram? 我必须使用instagram中的“分页”吗? If i need to, how should i do that? 如果需要,该怎么办?
Thanks in advance, 提前致谢,
Armando v O 阿曼多v O
I fixed it now. 我现在修复了。 Im doing it without the pagination class. 我没有分页课程就这样做了。 So it's saving code. 因此,它节省了代码。 Means less server space. 意味着更少的服务器空间。 (Not that it's much space). (并不是说有很多空间)。
$getFollowers = $instagram->getUserFollower()
$iFollowers = 0;
do{
$iFollowers += count($getFollowers->data);
if($getFollowers->pagination->next_url){
$getFollowers = json_decode(file_get_contents($getFollowers->pagination->next_url));
} else {
$getFollowers = FALSE;
}
}while ($getFollowers !== FALSE);
echo 'Followers: '.$iFollowers. "<br / >";
Thanks for helping. 感谢您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.