title: Steam loading inventory trying until its loaded
body: <p>Here is the code i wrote so far: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  do {
      //If this isn't the first time in the loop, pause for a second to prevent spamming their servers
      if(isset($statusCode)){
          sleep(1);
      }
  
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, "http://steamcommunity.com/profiles/76561198258195397/inventory/json/730/2");
      //The curl request should return the body of the text
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      //Apparently the URL provided initially returns with a 3XX response, this option follows the redirection.
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  
      $steamData = curl_exec($ch);
  
      $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      //Repeat this command until we get a successful request
      //Note that this is slightly naive - Any 2XX should be deemed successful.
  } while ($statusCode !== 200);
  
  //$steamData = file_get_contents("http://steamcommunity.com/profiles/76561198258195397/inventory/json/730/2");
  $data = json_decode($steamData, true);
  $items = $data['rgDescriptions'];
  foreach($items as $key =&gt; $item){
    $market_hash_name = $item["market_hash_name"];
    $market_hash_name = htmlentities($market_hash_name, ENT_QUOTES, 'UTF-8');
    $sql = "SELECT price FROM itemprice WHERE market_hash_name='".$market_hash_name."'";
    $result = $conn-&gt;query($sql);
    $itemprice = "-";
    if ($result-&gt;num_rows &gt; 0) 
    {
     while($row = $result-&gt;fetch_assoc()) 
     {
      if($row['price']&gt;0.02){
       $itemprice = $row['price'];
       $itemprice = floatval($itemprice);
       $itemprice = $itemprice*1.05;
       $itemprice = round($itemprice, 3);
      }else{
       $itemprice = 0;
      }
     }
    }
          echo '&lt;div class="items"&gt;&lt;center&gt;&lt;img src="http://steamcommunity-a.akamaihd.net/economy/image/' . $item["icon_url"] . '" height="192" width="256"&gt;&lt;/center&gt;&lt;div&gt;&lt;center&gt;&lt;h5 style="color:#'.$item["name_color"].'"&gt;'.$item["market_name"].' - &lt;strong&gt;&lt;b&gt;&lt;a style="color:green"&gt;$'.$itemprice.'&lt;/a&gt;&lt;/b&gt;&lt;/strong&gt;&lt;/h5&gt;&lt;/center&gt;&lt;/div&gt;&lt;/div&gt;';
  } 
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So sometimes its just loading and after around 20sec it stops the chrome giving me an error like i dont have internet connection, and i cant open any page on the site for 1min.But after that everything is okay...Does anybody know another alternative to get the inv? 
  here is a ss of the output on the site: <a href="https://gyazo.com/80e9d1cf3e6dd0ae151a9f85cc1e0cf9" rel="nofollow">https://gyazo.com/80e9d1cf3e6dd0ae151a9f85cc1e0cf9</a></p>