I want to follow the list of user IDs on instagram. I have made a list, and when I try to send the following request using api, I get this error: Client request limit reached (code: 400)
Developer documentation says: "You are limited to 5,000 requests per hour for access_token or client_id in general."
but when I get this error, my code is unlikely to follow 50 user IDs!
And one more thing, when I got this error, I tried to follow people in the appagram directive (without using api), and there were no problems!
This is the part of my code that gets this error:
foreach ($usersArr as $user) {
$i++;
$url = 'https://api.instagram.com/v1/users/'.$user->id.'/relationship?access_token='. $accessToken;
$data = 'action=follow';
$resultObj = json_decode(sendPostData($url, $data));
$responseCode = $resultObj->meta->code;
$errorMsg = $resultObj->meta->error_message;
if ($responseCode != 200)
echo "\"" . $errorMsg . "\" AT " . date('Y-m-d H:i:s') . "\n\n";
while ($responseCode != 200){
sleep(60);
$resultObj = json_decode(sendPostData($url, $data));
$responseCode = $resultObj->meta->code;
if ($responseCode != 200) {
$errorMsg = $resultObj->meta->error_message;
echo "STILL \"" . $errorMsg . "\" AT " . date('Y-m-d H:i:s') . "\n\n";
}
elseif($responseCode == 200){
echo "Limit Finished At: " . date('Y-m-d H:i:s') . "\n\n";
break;
}
}
echo "User NO. " .$i . " has been followed!" . "\n\n";
}
Many thanks:)