Steam Trading Platform

Please tell me if it is possible to pull information about all things from the steam trading platform? Preferably in json format.

<?php
$customUrl = "apocalypsys";
$url = "http://steamcommunity.com/id/$customUrl/inventory/json/730/2";

$json = json_decode(file_get_contents("$url"),true);
foreach($json["rgDescriptions"] as $key => $value)
    {
        if($json["rgDescriptions"]["$key"]["tradable"] == 1 && $json["rgDescriptions"]["$key"]["marketable"] == 1)
            {
            $market_hash_name = rawurlencode($json["rgDescriptions"]["$key"]["market_hash_name"]);
            $price = json_decode(file_get_contents("http://steamcommunity.com/market/priceoverview/?currency=0&appid=730&market_hash_name=$market_hash_name"),true);
            if($price["success"] == 1)
                {
                echo $json["rgDescriptions"]["$key"]["market_name"]." lowest price: ".$price["lowest_price"]." median price:".$price["median_price"]."</br>";
                }
            }
    }
?>

So I tried to get the price of my own inventory. On the 21st inventory item, the server says:

Failed to open stream: HTTP request failed! HTTP/1.0 429

P.s. Of course, I would like to make my own copy of the TP in the database and update it several times a day.

Upd: Tell me if it is possible to simulate ssl connection?

Author: Apocalypsys, 2016-04-08

2 answers

Make requests from different IP addresses (if the account is not verified, then you will have to register several additional ones). For example, there are VPN services where you can change the server (pay 300-500 rubles per month). Then you can run the script immediately from a bunch of accounts/ip addresses, and you will not have 20 requests per unit of time, but 20*N.

A number of sites with such restrictions have a bug in which the record of the connection is recorded after the end of processing the request (the reason is that commit to the database occurs at the end of processing). So if instead of 20 consecutive ones, you make 10,000 parallel ones, then maybe all of them will succeed.

 1
Author: Manushin Igor, 2016-04-21 14:52:04

Well, in general, you can, but here you will have to use a third-party api , I implemented this for steambot on nodejs as follows


//парсинг цены итемов
var g_PricesUpdate = 300; // интервал в секундах
var prices;
function getprices(){
   request('https://api.csgofast.com/price/all', function(error, response, body) {
       prices = JSON.parse(body);
       if(response.statusCode != 200) {
           logger.info("Не могу загрузить цены с сайта. Юзаю Файл.");
           if(fs.existsSync(__dirname + '/prices.txt')){
               prices = JSON.parse(fs.readFileSync(__dirname + '/prices.txt'));
               logger.info('Старые Цены Загружены!');
           }
       } else {
           fs.writeFileSync('prices.txt', body);
           logger.info('Цены Успешно Обновлены!');
       }
   });
}
setInterval(function(){getprices();},g_PricesUpdate*1000);
getprices();
///////////////////////////////////

I do not think that it will be difficult to rewrite under php , as a result, we get the file with the following content

{"StatTrak™ Dual Berettas | Dualing Dragons (Battle-Scarred)":0.28}

 0
Author: Gam-Studio, 2016-06-30 22:12:57