我正在尝试为我在包含武器的数组中获得的不同对象创建一个“回声”价格:
我读了很多关于如何通过Steamapi通过Steammarket获得价格的文章:
(这些来源都不符合我的要求)来源:
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
我终于找到了一个可以完美工作的代码片段。
文件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;
}
}output>
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;
}
?>output>
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)到目前为止还不错..
I get error in the result以下是我的代码:
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>
有没有人能帮我解决这个问题?
提前谢谢你
诚挚的问候
丹尼尔
发布于 2016-02-22 03:42:52
Priceoverview 'API‘端点受到Steam的速率限制,最近甚至受到Valve的速率限制。你得到了429 HTTP状态码,它代表“太多的请求”,你向他们的站点发送请求的方式太频繁了。
https://stackoverflow.com/questions/35428817
复制相似问题