title: mgp25 Instagram-API too many API requests
body: <p>I want to get all followers of two entered users. I did this but when tried the users have a million followers, for example (5 Million, etc...), I got this error from Instagram.</p>
  
  <p>In my example:</p>
  
  <p>-> User1 has 5 Million followers</p>
  
  <p>-> User2 has 7 Millon followers</p>
  
  <p>I need to get these user's followers then store two array and compare each other.</p>
  
  <p>I did this but only small accounts...</p>
  
  <blockquote>
    <p>Something went wrong: Throttled by Instagram because of too many API requests. Something went wrong: Throttled by Instagram because of too many API requests.</p>
  </blockquote>
  
  <p>Here my code:</p>
  
  <pre><code>    require 'vendor/autoload.php';
  
  \InstagramAPI\Instagram::$allowDangerousWebUsageAtMyOwnRisk = true;
  
  $username = 'test_35_1041';
  $password = '*****';
  
  $ig = new \InstagramAPI\Instagram();
  
  try {
      $ig-&gt;login($username,$password);
  } catch (\Exception $e) {
      echo $e-&gt;getMessage();
  }
  if (!empty($_POST)){
  
      $name1 = $_POST["username1"];
      $name2 = $_POST["username2"];
  
      $userId = $ig-&gt;people-&gt;getUserIdForName($name1);
      $userId2 = $ig-&gt;people-&gt;getUserIdForName($name2);
  
      $items = array();
      $items2 = array();
  
      $time_start = microtime(true);
     try {
          $maxId = null;
          $rankToken = \InstagramAPI\Signatures::generateUUID();
          do {
              $response = $ig-&gt;people-&gt;getFollowers($userId,$rankToken,null,$maxId);
              $json = json_decode($response);
              foreach ($json-&gt;users as $value) {
                  # code...
                  $items[] = $value-&gt;username;
                  //print_r($value-&gt;username);
              }
              $maxId = $response-&gt;getNextMaxId();
              flush();
          } while ($maxId !== null);
      } catch (\Exception $e) {
          echo 'Something went wrong: '.$e-&gt;getMessage()."\n";
      }
  
      try {
          $maxId = null;
          $rankToken = \InstagramAPI\Signatures::generateUUID();
          do {
              $response = $ig-&gt;people-&gt;getFollowers($userId2,$rankToken,null,$maxId);
              $json = json_decode($response);
              foreach ($json-&gt;users as $value) {
                  # code...
                  $items2[] = $value-&gt;username;
                  //print_r($value-&gt;username);
              }
              $maxId = $response-&gt;getNextMaxId();
          } while ($maxId !== null);
      } catch (\Exception $e) {
          echo 'Something went wrong: '.$e-&gt;getMessage()."\n";
      }
      $time_end = microtime(true);
      $execution_time = ($time_end - $time_start)/60;
  
      $result = array_intersect($items, $items2);
  }
  </code></pre>
  
  <p>I think its more complex, ı need to optimize this code for your help pls...
  How can ı solve this problem?</p>
  
  <p>Thanks Everyone.</p>