Bom, vou me tentar me explicar a minha dúvida da melhor forma:
<?php
$steamid = 76561198337627631;
$prices = file_get_contents('prices.txt');
$prices = json_decode($prices, true);
$inv = curl('https://steamcommunity.com/profiles/'.$steamid.'/inventory/json/730/2/');
$inv = json_decode($inv, true);
$items = array();
foreach ($inv['rgInventory'] as $key => $value) {
$id = $value['classid'].'_'.$value['instanceid'];
$trade = $inv['rgDescriptions'][$id]['tradable'];
if(!$trade) continue;
$name = $inv['rgDescriptions'][$id]['market_hash_name'];
$price = $prices['response']['items'][$name]['value']*10;
$img = 'http://steamcommunity-a.akamaihd.net/economy/image/'.$inv['rgDescriptions'][$id]['icon_url'];
$items[] = array(
'assetid' => $value['id'],
'bt_price' => "0.00",
'img' => $img,
'name' => $name,
'price' => $price,
'reject' => $reject,
'sa_price' => $price,
'steamid' => $steamid);
}
// curl
function getTemplate($name, $in = null) {
extract($in);
ob_start();
include "template/" . $name;
$text = ob_get_clean();
return $text;
}
function curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
Tenho o seguinte código, e pretendo dar um echo da minha array items, mostrando todos os parametros da mesma, contudo tem que ser em while porque eu tenho vários itens, como poderei fazer isso?
Obrigado.
foreach
depois do while e aí já pode imprimir cada parametro de cada item