0

我正在尝试使用这段代码获取用户的 Steam 库存:

    $url = $steamprofile['profileurl']."inventory/json/730/2";
    var_dump($url);
    $json = json_decode(file_get_contents($url));


    foreach($json->rgDescriptions as $value => $v) {
        if ($v->tradable === 1) {
            $name = $v->market_hash_name;
            $icon_url = $v->icon_url;
            ?>
            <div class="img__wrap">
                <img class="img__img" src="http://cdn.steamcommunity.com/economy/image/<?=$icon_url?>" />
                <div class="img__description_layer">
                     <p class="img__description"><?= $name ?></p>
                </div>
            </div>
        <?php
    } else {

    }
}

但是,如果我刷新页面大约 2-4 次,我会收到 HTTP 429 Too Many Requests 错误。有什么办法可以使这种情况不会发生,或者这只是我无法解决的问题?

4

0 回答 0