Created
April 5, 2013 20:57
-
-
Save dipth/5322582 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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