0

I'm using the TF2 Json to grab the color of an item, when I try to grab the color nothing is returned.

foreach($items as $item) {
    if($item["tradable"] == 1) {

        $image_url = "http://cdn.steamcommunity.com/economy/image/";

        if($item["icon_url_large"]) {
            $image_url   = $item["icon_url_large"];
        } else {
            $image_url = $item["icon_url"];
        }

        $hash = str_replace("+", "%20", urlencode($item["market_hash_name"]));
        echo "<a href='http://steamcommunity.com/market/listings/440/$hash'>" . PHP_EOL;
        HERE > echo "<img class='item' style='border: 3px solid #". $item["tags[0].color"]; TRYING TO GRAB THIS
        echo "; border-radius: 5px;' src='http://cdn.steamcommunity.com/economy/image/$image_url' />";
        echo "</a>" . PHP_EOL;

        echo PHP_EOL;
    }
}

Everything else in that code works fine, here is the json up until the tags: https://pastebin.com/Gth8p7AP

Here is what the HTML returns:

<img class="item" style="border: 3px solid #; border-radius: 5px;" src="http://cdn.steamcommunity.com/economy/image/fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZULUrsm1j-9xgEIYxQcWA_ruwdAidvjMviZBucMnuUs4IRc5jpqgwZ-euG2MWM2IAKXUvhYBPBpo1_oD3M268I2B9TloOtSeFi9t4DBN7MlY9FSX56H0R-bbNc">

1 Answers1

3

It looks like what you are trying to do is:

$item["tags"][0]["color"]
dave
  • 62,300
  • 5
  • 72
  • 93