include 'FileSystemCache.php'; //testing classes //using double quotes seems to make all names work (see issue: https://github.com/kevinohashi/php-riot-api/issues/33) $summoner_name = "RiotSchmick"; $summoner_id = 585897; $test = new riotapi('na'); $testCache = new riotapi('na', new FileSystemCache('cache/')); //$r = $test->getSummonerByName($summoner_name); //$r = $test->getSummoner($summoner_id); //$r = $test->getSummoner($summoner_id,'masteries'); //$r = $test->getSummoner($summoner_id,'runes'); //$r = $test->getSummoner($summoner_id,'name'); //$r = $test->getStats($summoner_id); //$r = $test->getStats($summoner_id,'ranked'); //$r = $test->getTeam($summoner_id); //$r = $test->getLeague($summoner_id); //$r = $test->getGame($summoner_id); //$r = $test->getChampion(); try { $r = $test->getSummonerByName($summoner_name); print_r($r); } catch (Exception $e) { echo "Error: " . $e->getMessage(); } echo "<br>\r\n testing cache:"; try { $r = $testCache->getSummoner($summoner_id); print_r($r); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
include 'FileSystemCache.php'; $platform = array("na" => "NA1", "euw" => "EUW1", "eune" => "EUN1", "br" => "BR1", "lan" => "LA1", "las" => "LA2", "oce" => "OC1", "ru" => "RU1", "tr" => "TR1"); $messageSumm = array("NOT_FOUND" => "Invocateur non trouvé"); $messageGame = array("NOT_FOUND" => "L'Invocateur n'a pas fait de parties classées"); //AngularJS balance les données passées en POST dans l'input, donc bricolage obligatoire $_POST = json_decode(file_get_contents('php://input'), true); // if(true){ if (isset($_POST['servor']) && isset($_POST['summoner'])) { $server = $_POST['servor']; $summoner = $_POST['summoner']; // $server="euw"; // $summoner="paigeounette"; $api = new riotapi($server, new FileSystemCache('cache/')); try { //Recherche de l'invocateur par son nom $r = $api->getSummonerByName($summoner); foreach ($r as $r) { $id = $r['id']; } try { //Recherche de la liste des match en SoloQ $r = $api->getMatchList($id, "RANKED_SOLO_5x5"); // /* //Initialisation des variables et des tableaux; $stop = 0; $arrayIds = array(); $total = array(); $total['nbMatches'] = 0; $total['AFK'] = 0; $total['AFKtargetTeam'] = 0; $total['AFKotherTeam'] = 0;