Answer the question
In order to leave comments, you need to log in
How to ask prices of CSGO skins?
Hey!
I've been struggling with the issue of parsing prices for CS:GO skins for a long time...
In general, a link with prices: prices here
Displayed like this: " Autograph Capsule | Team Liquid | MLG Columbus 2016 ": 0.36 ,
What is highlighted is the name of the skin, and its price in USD
Tried to parse with this code:
$url = 'https://api.csgofast.com/price/all';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$auth = curl_exec($curl);
if ($auth) {
$json = json_decode($auth, true);
foreach ($json as $names => $item) {
if ($names == $name) {
return $item;
break;
}
}
}
Answer the question
In order to leave comments, you need to log in
2) throw out if ($names == $name) , print the name/price
first 1) check that everything works from the server, that $auth is not empty, print it first too
You have a separator ":" between the price and the name of the skin,
use the explode function, more details here .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question