Chain Methods - Allyans3/steam-market-api-v2 GitHub Wiki
v4.0.0 or later is required to use this Chain Methods.
Can be called before final method (Steam Methods, Inspect Methods):
$api = new SteamApi();
$options = [
'market_hash_name' => "AK-47 | Slate (Field-Tested)"
];
$proxy = [
'ip' => '108.132.80.12',
'port' => '3128',
'type' => 1,
'user_agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36"
];
$api->detailed()
->withProxy($proxy)
->makeHidden(['page_size', 'total_count'])
->getItemListings(Apps::CSGO_ID, $options);
Methods
- detailed()
- withProxy(array $proxy)
- withCookies($cookie)
- withCustomCurlOpts(array $curlOpts)
- select(array $select)
- makeHidden(array $makeHidden)
- withInspectData()
detailed()
Used to get detailed response like:
[
"request_headers" => [...]
"response_headers" => [...]
"url" => "https://steamcommunity.com/market/recent?country=US&language=english¤cy=1&norender=1"
"code" => 200
"message" => "OK"
"error" => ""
"cookies" => []
"remote_ip" => "102.32.198.85"
"local_ip" => "192.168.0.101"
"total_time" => "361"
"response" => [...]
]
withProxy(array $proxy)
Used to make request with proxy.
Keys that can be in an array:
ip
+port
ordomain_name
–domain_name
used for rotating proxyuser
+pass
– if proxy support authtype
– you can pass constant variable or integer as explained in table belowtimeout
– in seconds, default infiniteconnect_timeout
– in seconds, default infiniteuser_agent
– your Useragent
In v4.2.1
added additional field, that support url based proxy services
url
– for url based proxy services, for example: "http://api.example-proxyservice.com/?token=******&url="
cURL Proxy Type | Integer |
---|---|
CURLPROXY_HTTP | 0 |
CURLPROXY_HTTP_1_0 | 1 |
CURLPROXY_HTTPS | 2 |
CURLPROXY_SOCKS4 | 4 |
CURLPROXY_SOCKS4A | 6 |
CURLPROXY_SOCKS5 | 5 |
CURLPROXY_SOCKS5_HOSTNAME | 7 |
withCookies($cookie)
Used to make request with cookies.
You can send string or key-value array.
withCustomCurlOpts(array $curlOpts)
Used to make request with custom CURL OPTIONS.
You also can use it instead of withProxy($proxy) method as was explained in Old Documentation#Proxy.
Example:
$curlOpts = [
CURLOPT_COOKIE => "sessionid=*****************; steamCountry=**|***************************;",
...
];
select(array $select)
Used to select only needed keys from response.
For this:
- You need to describe the same structure as your array.
- For multidimensional array with
int
keys, use%key_name%
pattern. - If you need whole array, write only
key_name
without value.
For example, you will get in response:
[
"start" => 0,
"page_size" => 10,
"total_count" => 2007,
"listings" => [
0 => [
"listing_id" => "4014424551600801890",
"asset" => [
"id" => "27693743966",
"class_id" => "4839713730",
"instance_id" => "480085569",
"market_hash_name" => "AK-47 | Slate (Field-Tested)",
"amount" => "1",
"status" => 2
],
],
1 => [
"listing_id" => "4014424551600801890",
"asset" => [
"id" => "27693743966",
"class_id" => "4839713730",
"instance_id" => "480085569",
"market_hash_name" => "AK-47 | Slate (Field-Tested)",
"amount" => "1",
"status" => 2
],
],
...
]
]
And you want to get only start
, total_count
and some keys from listings
array:
$select = [
"start",
"total_count",
"%listings%" => [
"listing_id",
"asset" => [
"id",
"market_hash_name"
]
]
];
You will get:
[
"start" => 0,
"total_count" => 2007,
"listings" => [
0 => [
"listing_id" => "4014424551600801890",
"asset" => [
"id" => "27693743966",
"market_hash_name" => "AK-47 | Slate (Field-Tested)",
],
],
1 => [
"listing_id" => "4014424551600801890",
"asset" => [
"id" => "27693743966",
"market_hash_name" => "AK-47 | Slate (Field-Tested)",
],
],
...
]
]
makeHidden(array $makeHidden)
The same as select(array $select), but remove unnecessary keys from response.
withInspectData()
Used to get inspect_items
array with response data of items from CSGOFloat API.
Only for UserInventory
and UserInventoryAuth
methods