Skip to content

Instantly share code, notes, and snippets.

@dipth
Created April 5, 2013 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dipth/5322582 to your computer and use it in GitHub Desktop.
Save dipth/5322582 to your computer and use it in GitHub Desktop.
$apiKey = "aaaaaaaaaaaaaaaaaaaa"; // Replace with real api key
$summonerName = $_GET['nick1'];
$apiUrl = "http://api.elophant.com/v2/euw/summoner/{$summonerName}?key={$apiKey}";
$jsonObject = json_decode(file_get_contents($apiUrl));
if ( isset($jsonObject['data']) ) {
$data = $jsonObject->{'data'};
if ( isset($data['summonerId']) ) {
$summonerId = $data->{'summonerId'};
if ( $summonerId == $_GET['steamid1']) {
// The id matches the one the user provided.. Horay!
} else {
// Tell the user that he entered an invalid summoner id
}
} else {
// Tell the user that the summoner does not exist
}
} else {
// Tell the user that the summoner does not exist
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment