I want to print data specific to a JSON.
I have the following code:
<?php
$summoner = "ErickReplay";
$key = "mikey";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://lan.api.riotgames.com/api/lol/LAN/v1.4/summoner/by-name/'.$summoner.'?api_key='.$key);
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
print_r($obj);
?>
It prints the following:
stdClass Object ( [erickreplay] => stdClass Object ( [id] => 143048 [name] => ErickReplay [profileIconId] => 547 [revisionDate] => 1496449271000 [summonerLevel] => 30 ) )
What I want is to print only the id which would be 143048. I have tried in different ways, but I can not get it.