I'm trying to decode json and display results with php but getting nothing back. Could anyone take a look and tell me what I'm doing wrong?
Here is an example of my php :
class League
{
public function __construct($region, $id, $summid) {
global $apiKey;
global $errorAPI;
$data = RIOT_API . "$region/v2.3/league/by-summoner/" . urlencode($summid) . "?api_key=$apiKey";
$info = httpResp($data);
if ($info[1] == false)
{
$League = json_decode(file_get_contents($data) , true);
for ($i = 0; $i < count($League['entries']); $i++)
{
if ($League['entries'][$i]['playerOrTeamId'] == $summid)
{
$floor = $i;
break;
}
}
$this->leaguename = $League['entries'][$floor]['leagueName'];
$this->tier = $League['entries'][$floor]['tier'];
$this->points = $League['entries'][$floor]['leaguePoints'];
$this->rank = $League['entries'][$floor]['rank'];
$this->wins = $League['entries'][$floor]['wins'];
$this->exists = true;
}
else
{
echo "Error " . $info[0] . " - " . array_search($info[0], $errorAPI);
$this->exists = false;
}
}
}
Here is my php for outputting:
$newLeague1 = new League("euw", "Deew0n", "24361317");
echo '<br />League Name : ', $newLeague1->name;
echo "
";
echo '<br />Position : ', $newLeague1->position;
echo "
";
echo '<br />League Points : ', $newLeague1->leaguePoints;
echo "
";
echo '<br />Wins/Losses: ', $newLeague1->wins, "/", $newLeague1->totalgames;
echo "
";
echo '<br />Division Name: ', $newLeague1->tier, ' ', $newLeague1->rank;
And lastly this is the json I am dealing with : http://pastebin.com/9FKgrjeS