|
@@ 199-231 (lines=33) @@
|
| 196 |
|
* @return mixed |
| 197 |
|
*/ |
| 198 |
|
////System ID to name via CCP |
| 199 |
|
function systemName($systemID) |
| 200 |
|
{ |
| 201 |
|
$logger = new Logger('eveESI'); |
| 202 |
|
$logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG)); |
| 203 |
|
|
| 204 |
|
try { |
| 205 |
|
// Initialize a new request for this URL |
| 206 |
|
$ch = curl_init("https://esi.tech.ccp.is/latest/universe/systems/{$systemID}/"); |
| 207 |
|
// Set the options for this request |
| 208 |
|
curl_setopt_array($ch, array( |
| 209 |
|
CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect |
| 210 |
|
CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data |
| 211 |
|
CURLOPT_TIMEOUT => 8, |
| 212 |
|
CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate |
| 213 |
|
)); |
| 214 |
|
// Fetch the data from the URL |
| 215 |
|
$data = curl_exec($ch); |
| 216 |
|
// Close the connection |
| 217 |
|
curl_close($ch); |
| 218 |
|
$data = json_decode($data, TRUE); |
| 219 |
|
$name = (string) $data['name']; |
| 220 |
|
|
| 221 |
|
} catch (Exception $e) { |
| 222 |
|
$logger->error('EVE ESI Error: ' . $e->getMessage()); |
| 223 |
|
$url = "https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={$systemID}"; |
| 224 |
|
$xml = makeApiRequest($url); |
| 225 |
|
foreach ($xml->result->rowset->row as $entity) { |
| 226 |
|
$name = $entity->attributes()->name; |
| 227 |
|
} |
| 228 |
|
} |
| 229 |
|
|
| 230 |
|
return $name; |
| 231 |
|
} |
| 232 |
|
|
| 233 |
|
/** |
| 234 |
|
* @param string $systemID |
|
@@ 404-436 (lines=33) @@
|
| 401 |
|
* @return mixed |
| 402 |
|
*/ |
| 403 |
|
////Alliance ID to name via CCP |
| 404 |
|
function allianceName($allianceID) |
| 405 |
|
{ |
| 406 |
|
$logger = new Logger('eveESI'); |
| 407 |
|
$logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG)); |
| 408 |
|
|
| 409 |
|
try { |
| 410 |
|
// Initialize a new request for this URL |
| 411 |
|
$ch = curl_init("https://esi.tech.ccp.is/latest/alliances/{$allianceID}/"); |
| 412 |
|
// Set the options for this request |
| 413 |
|
curl_setopt_array($ch, array( |
| 414 |
|
CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect |
| 415 |
|
CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data |
| 416 |
|
CURLOPT_TIMEOUT => 8, |
| 417 |
|
CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate |
| 418 |
|
)); |
| 419 |
|
// Fetch the data from the URL |
| 420 |
|
$data = curl_exec($ch); |
| 421 |
|
// Close the connection |
| 422 |
|
curl_close($ch); |
| 423 |
|
$data = json_decode($data, TRUE); |
| 424 |
|
$name = (string) $data['alliance_name']; |
| 425 |
|
|
| 426 |
|
} catch (Exception $e) { |
| 427 |
|
$logger->error('EVE ESI Error: ' . $e->getMessage()); |
| 428 |
|
$url = "https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={$allianceID}"; |
| 429 |
|
$xml = makeApiRequest($url); |
| 430 |
|
foreach ($xml->result->rowset->row as $entity) { |
| 431 |
|
$name = $entity->attributes()->name; |
| 432 |
|
} |
| 433 |
|
} |
| 434 |
|
|
| 435 |
|
return $name; |
| 436 |
|
} |
| 437 |
|
|
| 438 |
|
/** |
| 439 |
|
* @param string $systemName |
|
@@ 483-515 (lines=33) @@
|
| 480 |
|
* @return mixed |
| 481 |
|
*/ |
| 482 |
|
////TypeID to TypeName via CCP |
| 483 |
|
function apiTypeName($typeID) |
| 484 |
|
{ |
| 485 |
|
$logger = new Logger('eveESI'); |
| 486 |
|
$logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG)); |
| 487 |
|
|
| 488 |
|
try { |
| 489 |
|
// Initialize a new request for this URL |
| 490 |
|
$ch = curl_init("https://esi.tech.ccp.is/latest/universe/types/{$typeID}/"); |
| 491 |
|
// Set the options for this request |
| 492 |
|
curl_setopt_array($ch, array( |
| 493 |
|
CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect |
| 494 |
|
CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data |
| 495 |
|
CURLOPT_TIMEOUT => 8, |
| 496 |
|
CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate |
| 497 |
|
)); |
| 498 |
|
// Fetch the data from the URL |
| 499 |
|
$data = curl_exec($ch); |
| 500 |
|
// Close the connection |
| 501 |
|
curl_close($ch); |
| 502 |
|
$data = json_decode($data, TRUE); |
| 503 |
|
$name = (string) $data['name']; |
| 504 |
|
|
| 505 |
|
} catch (Exception $e) { |
| 506 |
|
$logger->error('EVE ESI Error: ' . $e->getMessage()); |
| 507 |
|
$url = "https://api.eveonline.com/eve/TypeName.xml.aspx?ids={$typeID}"; |
| 508 |
|
$xml = makeApiRequest($url); |
| 509 |
|
foreach ($xml->result->rowset->row as $entity) { |
| 510 |
|
$name = $entity->attributes()->typeName; |
| 511 |
|
} |
| 512 |
|
} |
| 513 |
|
|
| 514 |
|
return $name; |
| 515 |
|
} |
| 516 |
|
|
| 517 |
|
/** |
| 518 |
|
* @param string $typeName |