steam api, how to decode json file

i am trying steam api. Login works. I am getting json file with correct information

i have this json file

{
    "response": {
        "players": [
            {
                "steamid": "76561198074129999",
                "communityvisibilitystate": 3,
                "profilestate": 1,
                "personaname": "strogan",
                "lastlogoff": 1489940750,
                "commentpermission": 1,
                "profileurl": "http://steamcommunity.com/profiles/76561198074129999/",
                "avatar": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/e6/e647b5fca396b7ac04761ef5407a8e4792ca2407.jpg",
                "avatarmedium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/e6/e647b5fca396b7ac04761ef5407a8e4792ca2407_medium.jpg",
                "avatarfull": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/e6/e647b5fca396b7ac04761ef5407a8e4792ca2407_full.jpg",
                "personastate": 0,
                "primaryclanid": "103582791439804163",
                "timecreated": 1351075430,
                "personastateflags": 0
            }
        ]

    }
}

and i want to write for example name, or avatar and it anyway write nothing.

$steam = json_decode(file_get_contents("cache/{$_SESSION['T2SteamID64']}.json"));

echo $login;

echo "<img src="{$steam->response->players[0]->avatarfull}"/>";

this i get on web-site

<img src="">

Who need all code

<?php

include "apikey.php";
include "openid.php";


$OpenID = new LightOpenID("dcmwebsites.com");

session_start();


if (!$OpenID->mode) {

    if(isset($_GET['login'])){
        $OpenID->identity = "http://steamcommunity.com/openid";
        header("Location: {$OpenID->authUrl()}");
    }

    if(!isset($_SESSION['T2SteamAuth'])){
        $login = "
Welcome Guest. Please to *Website Action*.
"; } }elseif ($OpenID->mode == "cancel") { echo "User has canceled Authenticiation."; }else{ if (!isset($_SESSION['T2SteamAuth'])) { $_SESSION['T2SteamAuth'] = $OpenID->validate() ? $OpenID->identity: null; $_SESSION['T2SteamID64'] = str_replace("http://steamcomunity.com/openid/id/", "", $_SESSION['T2SteamAuth']); if ($_SESSION['T2SteamAuth'] !== null) { $Steam64 = str_replace("http://steamcommunity.com/openid/id", "", $_SESSION['T2SteamAuth']); $profile = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$api}&steamids={$Steam64}"); $buffer = fopen("cache/{$Steam64}.json", "w+"); fwrite($buffer, $profile); fclose($buffer); } header("Location: index.php"); } } if (isset($_SESSION['T2SteamAuth'])) { $login = ""; } if (isset($_GET['logout'])) { unset($_SESSION['T2SteamAuth']); unset($_SESSION['T2SteamID64']); header("Location: index.php"); } $steam = json_decode(file_get_contents("cache/{$_SESSION['T2SteamID64']}.json")); echo $login; echo "<img src="{$steam->response->players[0]->avatarfull}"/>"; ?>


Source: stackoverflow-php