title: PHP with JSON decode and steam api
body: <p>I am new to php at this stage, same about openID libraries. I want to make a website for Steam users so I need to display their inventory. I've downloaded some example things which most thing written but I still need something else. As a training I took a something else than inventory, but similiar. Didn't make it so I hope that you can help me.</p>
  
  <p>That's a example what I was looking at while trying to decode another data.</p>
  
  <pre><code>{
  "response": {
      "players": [
          {
              "steamid": "76hidden",
              "communityvisibilitystate": 3,
              "profilestate": 1
          }
      ]
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And code in PHP looks like</p>
  
  <pre><code>$url2 = file_get_contents("url");
  $content = json_decode($url2, true);
  $_SESSION['steam_steamid'] = $content['response']['players'][0]['steamid'];
  $steamprofile['steamid'] = $_SESSION['steam_steamid'];
  </code></pre>
  
  <p>And this one above is working well. Could you please explain me why there is 0 between "steamid" and "players"? Also it looks like the session name matters, am I right? I was doing some tests and when I changed the name session it didn't work.</p>
  
  <p>So here's what I am working on
  JSON code: </p>
  
  <pre><code>{
      "friendslist": {
          "friends": [
              {
                  "steamid": "765hidden",
                  "relationship": "friend",
                  "friend_since": 1428495026
              },
              {
                  "steamid": "764hidden",
                  "relationship": "friend",
                  "friend_since": 1355599210
              },
              {
                  "steamid": "764hidden",
                  "relationship": "friend",
                  "friend_since": 1423504205
              },
              much more friends
          ]
  
      }
  }
  </code></pre>
  
  <p>So I want to get the steamid and I got no idea how to get it. I've tried to get relationship as steamID is already used above:</p>
  
  <pre><code>$url3 = file_get_contents("url2");
  $content2 = json_decode($url3, true);
  $_SESSION['steam_relationship'] = $content2['friendslist']['friends'][0]['relationship'];
  $steamfriends['friend'] = $_SESSION['steam_relationship'];
  </code></pre>
  
  <p>And of course echo $steamfriend['friend'] is not working. I see that person who made these PHP files already know what are the session names (if they need to be right to work). Any ideas where can I find it? </p>
  
  <p>I feel really ashamed that I can't figure it myself.</p>
  
  <p>Regards.</p>