Get data from json and use just one result as value
<p>I'm trying to use www.football-data.org to get football league standings but i've never used JSON before.</p>

<p>Currently i'm using the following:</p>

<pre><code>$uri = 'http://api.football-data.org/v1/soccerseasons/398/leagueTable/';
$reqPrefs['http']['method'] = 'GET';
$reqPrefs['http']['header'] = 'X-Auth-Token:'.$api_key;

$stream_context = stream_context_create($reqPrefs);

$response = file_get_contents($uri, false, $stream_context);
$details = json_decode($response);
</code></pre>

<p>To try and get the details for one team. At the moment i'm using:</p>

<pre><code>echo "&lt;pre&gt;";
print_r($details);
echo "&lt;/pre&gt;";
</code></pre>

<p>to get the following to show:</p>

<pre><code>stdClass Object
(
    [_links] =&gt; stdClass Object
        (
            [self] =&gt; stdClass Object
                (
                    [href] =&gt; http://api.football-data.org/v1/soccerseasons/398/leagueTable/?matchday=26
                )

            [soccerseason] =&gt; stdClass Object
                (
                    [href] =&gt; http://api.football-data.org/v1/soccerseasons/398
                )

        )

    [leagueCaption] =&gt; Premier League 2015/16
    [matchday] =&gt; 26
    [standing] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [_links] =&gt; stdClass Object
                        (
                            [team] =&gt; stdClass Object
                                (
                                    [href] =&gt; http://api.football-data.org/v1/teams/338
                                )

                        )

                    [position] =&gt; 1
                    [teamName] =&gt; Leicester City FC
                    [crestURI] =&gt; http://upload.wikimedia.org/wikipedia/en/6/63/Leicester02.png
                    [playedGames] =&gt; 25
                    [points] =&gt; 53
                    [goals] =&gt; 47
                    [goalsAgainst] =&gt; 27
                    [goalDifference] =&gt; 20
                    [wins] =&gt; 15
                    [draws] =&gt; 8
                    [losses] =&gt; 2
                    [home] =&gt; stdClass Object
                        (
                            [goals] =&gt; 21
                            [goalsAgainst] =&gt; 13
                            [wins] =&gt; 7
                            [draws] =&gt; 4
                            [losses] =&gt; 1
                        )

                    [away] =&gt; stdClass Object
                        (
                            [goals] =&gt; 26
                            [goalsAgainst] =&gt; 14
                            [wins] =&gt; 8
                            [draws] =&gt; 4
                            [losses] =&gt; 1
                        )

                )
</code></pre>

<p>Firstly, how do I go about getting these values and saving them as a usable variable in PHP?</p>

<p>Secondly, is it possible to just narrow down this data to one team? For example to say:</p>

<pre><code>if($details-&gt;teamName == 'Manchester United') { $gamesPlayed = $details-&gt;gamesPlayed; }
</code></pre>