-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunc.php
34 lines (27 loc) · 811 Bytes
/
func.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
function setup_token()//setup access token in swagger config
{
global $provider;
global $config;
if (!empty($_SESSION['rftoken'])) {
$accessToken = $provider->getAccessToken('refresh_token', ['refresh_token' => $_SESSION['rftoken']]);
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken($accessToken->getToken());
}
}
function charid(){
return $_SESSION['charinfo']['CharacterID'];
}
function corpid(){
return $_SESSION['charinfo']['CorporationID'];
}
function getcorpid($charid){
global $config;
$api_instance = new Swagger\Client\Api\CharacterApi(null,$config);
try {
$char = $api_instance->getCharactersCharacterId($charid);
return $char['corporation_id'];
} catch (Exception $e) {
echo 'Exception: ', $e->getMessage(), PHP_EOL;
}
}
?>