我正在尝试为包含武器的数组中的不同对象制作“回声”价格:
我已经阅读了很多关于如何通过Steammarket通过Steamapi获取价格的信息:
(这些来源都不符合我的要求)
来源:
Get steam item prices
How get a response of multiple price items on the market
Get the price of an item on Steam Community Market with PHP and Regex
我终于找到了一个无瑕疵的代码片段
FILE marketprices.php
<?php
$items = array("Exalted Manifold Paradox","Kinetic Gem","Mercurial's Call");
foreach($items as $item)
{
$json = json_decode(file_get_contents("http://steamcommunity.com/market/priceoverview/?appid=570&market_hash_name=".rawurlencode($item)), true);
if($json["success"] == true OR !empty($json))
{
echo $item."'s lowest price is ".$json["lowest_price"]."";
}
elseif($json["success"] == false OR empty($json))
{
echo "Could not get data for ".$item;
}
}
输出&GT;
Exalted Manifold Paradox's lowest price is $28.49Kinetic Gem's lowest price is $50.00Mercurial's Call's lowest price is $0.16
来源:http://gamebanana.com/tuts/11942
When I am trying to implent this snippet to my code I get error in my result:
I have created an array that contains different weapons:
<?
foreach($S_W as $item) // Steam weapon
{
echo $item;
}
?>
输出&GT;
AWP | Worm God (Factory New)
FAMAS | Cyanospatter (Field-Tested)
G3SG1 | Green Apple (Factory New)
G3SG1 | Polar Camo (Field-Tested)
Glock-18 | Death Rattle (Field-Tested)
M249 | Gator Mesh (Field-Tested)
MAC-10 | Heat (Field-Tested)
到目前为止这是好事。
我在结果中收到错误 以下是我的代码:
foreach($S_W as $item)
{
$json = json_decode(file_get_contents("http://steamcommunity.com/market/priceoverview/?appid=570&market_hash_name=".rawurlencode($item)), true);
if($json["success"] == true OR !empty($json))
{
echo $item."'s lowest price is ".$json["lowest_price"]."";
}
elseif($json["success"] == false OR empty($json))
{
echo "Could not get data for ".$item;
}
}
我看到了错误的一部分..
在代码添加的URL末尾的调用中:</br>
有人可以帮我解决问题吗?
提前谢谢
祝你好运
丹尼尔
答案 0 :(得分:-1)
Priceoverview&#39; API&#39;端点受到Steam的限速,并且最近由Valve进一步限制了速率。您收到了429个HTTP状态代码,表示“请求太多”,您经常向其网站发送请求。