PHP Script Undefined Property and Invalid Argument Errors
<p>I am trying to run this PHP file and I keep getting errors like</p>

<pre><code>Undefined property: stdClass::$games
</code></pre>

<p>and</p>

<pre><code>Invalid argument supplied for foreach()
</code></pre>

<p>This is a picture of the error <a href="http://imageshack.us/a/img845/6270/34356212.jpg" rel="nofollow">http://imageshack.us/a/img845/6270/34356212.jpg</a> and below is the script I am running minus my Steam API key.</p>

<pre><code>&lt;?php
$api_key = '........';      //Steam API Key, Required to work
$lines = file('parse1.txt');                        //reads in the file with the list of user numbers
$game_id = 550;                                     //Steam Game ID, 440 is TF2

foreach ($lines as $usernumber) {                    //loops line by line
$link = 'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' . $api_key . '&amp;steamid=' . $usernumber . '&amp;format=json';
$json = file_get_contents($link);                   //Reads link (this ^)
$data = json_decode($json);
foreach ($data-&gt;response-&gt;games as $game) { 
    if ($game-&gt;appid == $game_id) {
        $playtime = $game-&gt;playtime_forever;
        if (($playtime &lt; 5400) &amp;&amp; ($playtime &gt; 1)) {
        //echo 'Playtime for ', $usernumber, ' is ' . $playtime."&lt;br&gt;";
                echo $usernumber."&lt;br&gt;";        
            }
        }
    }
}
?&gt;
</code></pre>

<p>Parse.txt contains steam ID's eg (76561197987683795, 76561198063283029)
I assume it has something to do with nested IF commands, but I have no idea what I am missing, any help would be huge! Thanks</p>
