enter code here
The error this code returns is
"Trying to get property of non-object" or "Message: Undefined property: stdClass::$name".
The variable $summoner is what does not work. Assume the variables sID, $lcaseregion and $APIkey (etc.) are all properly set.
<?php
$summonerURL = "https://$lcaseRegion.api.pvp.net/api/lol/$lcaseRegion/v1.4/summoner/" . $sID . "?api_key=9" . $APIkey;
$responseSummoner = @file_get_contents($summonerURL);
$summoner = @json_decode($responseSummoner);
echo print_r($summoner); //this works and prints things
echo $summoner->name; //this does not work
echo $summoner->profileIconId; //this also does not work.
//please find print_r results below...
?>
print_r results;
stdClass Object ( [41245441] => stdClass Object ( [id] => 41245441 [name] => Bubbalubagus [profileIconId] => 558 [revisionDate] => 1488775287000 [summonerLevel] => 30 ) )
Any other advice and tips you can give me on how the arrays work would also be appreciated.