I searched around for the answer to this but couldn't find anything and was looking for help from you wonderful people. I have been toying around with steam web API for my site. I have found this code and am using it. Also, I have barely any experience in steam api, most of my experience is in C. Anyway, here is the code:
[insert_php]
$api = "http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/?key=MyApiKey&steamid=MySteamId&format=json";
$json = (file_get_contents($api));
$schema = json_decode($json);
print var_dump($schema);
[/insert_php]
I am using a plugin and inserting this php into my WordPress page. This code goes into my steam backpack and gives me all the items I have in a complicated list. What I need help with is condensing it so that it can be easily read. A defining feature of the inventory items is the defindexes. What I want to do is have it so if it finds a certain amount of one item with the same defindex, it will return that amount like this into my page: Scrap Metal = # of defindexes of Scrap Metal found. I hope that this is clear enough and that there is an answer. Thank you.
Part of my code that is returned now:
{
"id": 1828947688,
"original_id": 1176490973,
"defindex": 5009,
"level": 1,
"quality": 6,
"inventory": 2147483650,
"quantity": 1,
"origin": 4
},
{
"id": 1828947700,
"original_id": 1176491289,
"defindex": 5009,
"level": 1,
"quality": 6,
"inventory": 2147483651,
"quantity": 1,
"origin": 4
},
{
"id": 1828947742,
"original_id": 1178541917,
"defindex": 5009,
"level": 1,
"quality": 6,
"inventory": 2147483652,
"quantity": 1,
"origin": 4
},
{
"id": 1828947755,
"original_id": 1178542060,
"defindex": 5009,
"level": 1,
"quality": 6,
"inventory": 2147483757,
"quantity": 1,
"origin": 4
},
{
"id": 1828947766,
"original_id": 1179066746,
"defindex": 5005,
"level": 1,
"quality": 6,
"inventory": 2147483653,
"quantity": 1,
"origin": 4
},
{
"id": 1828947780,
"original_id": 1181421843,
"defindex": 5009,
"level": 1,
"quality": 6,
"inventory": 2147483756,
"quantity": 1,
"origin": 4
},
{
"id": 1828947788,
"original_id": 1181426745,
"defindex": 5006,
"level": 1,
"quality": 6,
"inventory": 2147483654,
"quantity": 1,
"origin": 4
},
{
"id": 1828947793,
"original_id": 1187413384,
"defindex": 5007,
"level": 1,
"quality": 6,
"inventory": 2147483755,
"quantity": 1,
"origin": 4
},
{
"id": 1828947796,
"original_id": 1187413535,
"defindex": 5007,
"level": 1,
"quality": 6,
"inventory": 2147483655,
"quantity": 1,
"origin": 4
},
{
"id": 1828947801,
"original_id": 1187416362,
"defindex": 5007,
"level": 1,
"quality": 6,
"inventory": 2147483754,
"quantity": 1,
"origin": 4
},
{
"id": 1828947810,
"original_id": 1190342559,
"defindex": 5013,
"level": 1,
"quality": 6,
"inventory": 2147483656,
"quantity": 1,
"origin": 4
},
{
"id": 1828947826,
"original_id": 1190342965,
"defindex": 5013,
"level": 1,
"quality": 6,
"inventory": 2147483753,
"quantity": 1,
"origin": 4
},
{
"id": 1828947835,
"original_id": 1243518373,
"defindex": 5011,
"level": 1,
"quality": 6,
"inventory": 2147483657,
"quantity": 1,
"origin": 4
}
ETC.