コード例 #1
0
ファイル: getSummonerId.php プロジェクト: athellw/webphp
	<?php 
$summoner = $_POST['username'];
$server = $_POST['nation'];
$refined_name = RefineSummonerName($summoner);
$summoner_info_array = Summoner_name_to_idInfo($refined_name, $server);
$summoner_id = Summoner_id_return($summoner_info_array);
$match_list_array = match_list($summoner_id, $server);
$champion = champion_data(67);
// echo json_encode($match_list_array[0]);
echo json_encode($champion['image']);
function Summoner_name_to_idInfo($summoner, $server)
{
    $summoner_encoded = rawurlencode($summoner);
    $summoner_lower = strtolower($summoner_encoded);
    $curl = curl_init('https://' . $server . '.api.pvp.net/api/lol/' . $server . '/v1.4/summoner/by-name/' . $summoner . '?api_key=68023d09-7048-4d6f-acc7-2ae2121f2590');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
    $decoded_summoner_info = json_decode($result, true);
    $final_summoner_info = $decoded_summoner_info[$summoner];
    return $final_summoner_info;
}
function Summoner_id_return($data)
{
    $summoner_id = $data['id'];
    return $summoner_id;
}
function match_list($rawId, $server)
{
    $id = (string) $rawId;
    $curl = curl_init('https://' . $server . '.api.pvp.net/api/lol/' . $server . '/v2.2/matchlist/by-summoner/' . $id . '?api_key=68023d09-7048-4d6f-acc7-2ae2121f2590');
    // $curl = curl_init('https://kr.api.pvp.net/api/lol/kr/v2.2/matchlist/by-summoner/2427390?api_key=68023d09-7048-4d6f-acc7-2ae2121f2590');
コード例 #2
0
$re = $r->add('^fish')->add('^flash')->add('^fetish')->add('^foolish')->re(['indent' => 2]);
like('fish', '/' . $re . '/', 'fish/x');
like('flash', '/' . $re . '/', 'flash/x');
like('fetish', '/' . $re . '/', 'fetish/x');
like('foolish', '/' . $re . '/', 'foolish/x');
unlike('fetch', '/' . $re . '/', 'fetch/x');
match_list('lookahead car.*', ['caret', 'caress', 'careful', 'careless', 'caring', 'carion', 'carry', 'carried'], ['caret', 'caress', 'careful', 'careless', 'caring', 'carion', 'carry', 'carried']);
match_list('a.x', ['abx', 'adx', 'a.x'], ['aax', 'abx', 'acx', 'azx', 'a4x', 'a%x', 'a+x', 'a?x']);
/*
//�ۗ�
match_list( 'POSIX', ['X[0[:alpha:]%]','Y[1-4[:punct:]a-c]'] , ['X0','X%','Xa','Xf','Y1','Y;','Y!','yc'] );

match_list( 'c.z', ['c^z','c-z','c5z','cmz'] , ['c^z','c-z','c5z','cmz'] );
*/
match_list('\\d, \\D', ['b\\d', 'b\\D'], ['b4', 'bX', 'b%', 'b.', 'b?']);
match_list('abcd', ['abc', 'abcd', 'ac', 'acd', 'b', 'bc', 'bcd', 'bd'], ['abc', 'abcd', 'ac', 'acd', 'b', 'bc', 'bcd', 'bd']);
match('foo', 'foo', 'bar', 'rat', 'quux');
match('.[ar]it 1', 'bait', 'brit', 'frit', 'gait', 'grit', 'tait', 'wait', 'writ');
match('.[ar]it 2', 'bait', 'brit', 'gait', 'grit');
match('.[ar]it 3', 'bit', 'bait', 'brit', 'gait', 'grit');
match('.[ar]it 4', 'barit', 'bait', 'brit', 'gait', 'grit');
match('t.*ough', 'tough', 'though', 'trough', 'through', 'thorough');
match('g.*it', 'gait', 'git', 'grapefruit', 'grassquit', 'grit', 'guitguit');
match('show.*ess', 'showeriness', 'showerless', 'showiness', 'showless');
match('d*', 'den-at', 'dot-at', 'den-pt', 'dot-pt', 'dx');
match('d*', 'den-at', 'dot-at', 'den-pt', 'dot-pt', 'd-at', 'd-pt', 'dx');
match('un*ed', 'unimped', 'unimpeded', 'unimpelled');
match('(un)?*(ing)?ing', 'sing', 'swing', 'sting', 'sling', 'singing', 'swinging', 'stinging', 'slinging', 'unsing', 'unswing', 'unsting', 'unsling', 'unsinging', 'unswinging', 'unstinging', 'unslinging');
match('s.*at 1', 'sat', 'sweat', 'sailbat');
match('m[eant]+', 'ma', 'mae', 'man', 'mana', 'manatee', 'mane', 'manent', 'manna', 'mannan', 'mant', 'manta', 'mat', 'mate', 'matta', 'matte', 'me', 'mean', 'meant', 'meat', 'meet', 'meeten', 'men', 'met', 'meta', 'metate', 'mete');
match('ti[aeinost]+', 'tiao', 'tie', 'tien', 'tin', 'tine', 'tinea', 'tinean', 'tineine', 'tininess', 'tinnet', 'tinniness', 'tinosa', 'tinstone', 'tint', 'tinta', 'tintie', 'tintiness', 'tintist', 'tisane', 'tit', 'titanate', 'titania', 'titanite', 'titano', 'tite', 'titi', 'titian', 'titien', 'tittie');