0

I'm attempting to retrieve a price history from Steam Market items and for what I found this is what I need and what I would use as a base to get a price history:

http://steamcommunity.com/market/pricehistory/?country=PT&currency=3&appid=730&market_hash_name=Falchion%20Case

In browsers it works perfectly resulting in a JSON with a price history but in PHP it returns this:

Warning: file_get_contents(http://steamcommunity.com/market/pricehistory/?country=PT&currency=3&appid=730&market_hash_name=Falchion%20Case): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in E:\...\test.php on line 3

Already tried to work around with curls but until now nothing seems to work.

The code so far is:

<?php

echo file_get_contents("http://steamcommunity.com/market/pricehistory/?country=PT&currency=3&appid=730&market_hash_name=Falchion%20Case");

?>
auhmaan
  • 726
  • 1
  • 8
  • 28
  • Where did you get the info for that endpoint? Without knowing anything the name of this parameter: market_hash_name implies it doesn't take a plain text value – Tom Fobear Jul 22 '15 at 20:53
  • @TomFobear What is more important at the moment is that this endpoint stopped being supported - or at least it looks that way, for some time. And by the way, `market_hash_name` was realy something like `Falchion%20Case` or `AWP%20DragonLore`. :) – FanaticD Aug 03 '15 at 05:16

1 Answers1

0

As was mentioned here, it would be the best to try curl() to get more precise error message, therefore better answers.

There is one more thing at the moment you should know - Steam probably has taken some actions against people using this url to get to item price. Your 400 Bad Request may be (and most likely is) induced by not sending all the information the page requires.

For example - page may not have required any POST/GET parameter at the moment you started with implementing for yourself, but as the knowledge of the link become too common, Steam has decided to add another parameter to filter out 3rd parties that generate high load.

Possible way around would be digging deep to origins of this url (e.g. who and how found it), reproduce steps that has been taken at the first time and find out what has changed since then.


My best guess is that someone sniffed (Wireshark, Fiddler, etc.) around, what is the application sending when retreving item price history and that's how the one has found the link. You can try that too.

Community
  • 1
  • 1
FanaticD
  • 1,416
  • 4
  • 20
  • 36