echo "Error: " . $e->getMessage(); } } foreach (scandir($ranked_path) as $file) { if ('.' === $file) { continue; } if ('..' === $file) { continue; } $region = strtolower(basename($file, ".json")); $region_matches = json_decode(file_get_contents($ranked_path . "/" . $file), true); $total_matches = count($region_matches); $pos = 0; //Initialize API wrapper $api = new riotapi($region, $api_key); //Begin the calls, yo try { foreach ($region_matches as $match_id) { $m = $api->getMatch($match_id, 'includeTimeline=true'); if (isset($m["timeline"])) { $matches->insert($m); printf("inserted match " . $pos . " / " . $total_matches . " for " . $region . " ranked\n"); } else { printf("Missing timeline: match " . $pos . " / " . $total_matches . "\n"); } $pos++; } } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
<?php include 'php-riot-api.php'; $test = new riotapi('na'); try { $r = $test->getRealmData(); print_r(json_encode($r)); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
<?php include 'php-riot-api.php'; 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);
<?php include 'php-riot-api.php'; $summoner_id = $_GET["id"]; $champ_id = $_GET["champId"]; $test = new riotapi('na'); try { $r = $test->getMatchHistoryForChamp($summoner_id, $champ_id); print_r(json_encode($r)); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
<?php include 'includes/wrapper/php-riot-api.php'; include 'includes/wrapper/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 = "machinaxxx"; // $summoner_id = 585897; $test = new riotapi('na', '8d44fc30-4ef3-4a8e-8aae-a6b124e37f21'); // $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 { for ($i = 0; $i < 1; $i++) { // $r = $test->getSummonerByName($summoner_name); $r = $test->getMatch('1900737137', 'includeTimeline=true'); print_r($r); print_r($i); } } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
Dernière modification : 20/11/2015 */ include 'php-riot-api.php'; 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;
<?php include 'php-riot-api.php'; $test = new riotapi('na'); $id = $_GET["id"]; try { $r = $test->getChampionById($id); print_r(json_encode($r)); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
<?php include 'php-riot-api.php'; $summoner_name = $_GET["name"]; $test = new riotapi('na'); try { $r = $test->getSummonerId($summoner_name); print_r($r); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
<?php include 'php-riot-api.php'; $item_id = $_GET["itemId"]; $test = new riotapi('na'); try { $r = $test->getItemWithImage($item_id); print_r(json_encode($r)); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
<?php include 'php-riot-api.php'; $test = new riotapi('na'); try { $r = $test->getChampions(); print_r(json_encode($r)); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }