Total beginner with PHP, here.
I want to make a small website that is going to parse data from a JSON web page and put it on my website but for some reason, no data (the value of "length") is being returned PHP code:
<?
$jsonData = file_get_contents('web site link');
$data = json_decode($jsonData, TRUE);
foreach($data as $stats )
{
echo $stats->length;
}
// var_dump($jsonData);
?>
Json data (full data: http://logs.tf/json/2652721#76561198044689160):
"length": 1674,
"players": {
"[U:1:131277951]": {
"team": "Blue",
"class_stats": [{
"type": "soldier",
"kills": 16,
"assists": 2,
"deaths": 21,
"dmg": 7505,
"weapon": {
"tf_projectile_rocket": {
"kills": 16,
"dmg": 7505,
"avg_dmg": 58.6328125,
"shots": 0,
"hits": 0
}
},
"total_time": 1674
}],
What am I doing wrong? :(