I'm trying to use the RIOT API but I'm kinda stuck. So here's the output of the page :
{
"36694730": [{
"name": "Twitch's Marksmen",
"tier": "GOLD",
"queue": "RANKED_SOLO_5x5",
"entries": [{
"playerOrTeamId": "36694730",
"playerOrTeamName": "OU2S",
"division": "V",
"leaguePoints": 0,
"wins": 207,
"losses": 201,
"isHotStreak": false,
"isVeteran": false,
"isFreshBlood": true,
"isInactive": false
}]
}]}
What I've actually tried to do is :
<?php
$link = "https://euw.api.pvp.net/api/lol/euw/v2.5/league/by-summoner/36694730/entry?api_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$json = file_get_contents($link);
$get = json_decode($json, true);
// echo $get['name'];
echo $get->name;
?>
Both didn't work for me, thanks for taking the time to read this.
var_dump($json, $get)to see what you actually received? You're just assuming nothing could ever go wrong with this code, which is exactly the WRONG attitude to have. Never EVER assume success when dealing with external resources. Always assume failure, check for failure, and treat success as a pleasant surprise. Even if your PHP is 100% syntactically correct, what if that's the wrong url? What if that site is down, or there's a network glitch between your machine and that site?