|
@@ 194-226 (lines=33) @@
|
| 191 |
|
* @return mixed |
| 192 |
|
*/ |
| 193 |
|
////System ID to name via CCP |
| 194 |
|
function systemName($systemID) |
| 195 |
|
{ |
| 196 |
|
$logger = new Logger('eveESI'); |
| 197 |
|
$logger->pushHandler(new StreamHandler(__DIR__ . '../../log/libraryError.log', Logger::DEBUG)); |
| 198 |
|
|
| 199 |
|
try { |
| 200 |
|
// Initialize a new request for this URL |
| 201 |
|
$ch = curl_init("https://esi.tech.ccp.is/latest/universe/systems/{$systemID}/"); |
| 202 |
|
// Set the options for this request |
| 203 |
|
curl_setopt_array($ch, array( |
| 204 |
|
CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect |
| 205 |
|
CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data |
| 206 |
|
CURLOPT_TIMEOUT => 8, |
| 207 |
|
CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate |
| 208 |
|
)); |
| 209 |
|
// Fetch the data from the URL |
| 210 |
|
$data = curl_exec($ch); |
| 211 |
|
// Close the connection |
| 212 |
|
curl_close($ch); |
| 213 |
|
$data = json_decode($data, TRUE); |
| 214 |
|
$name = (string)$data['solar_system_name']; |
| 215 |
|
|
| 216 |
|
} catch (Exception $e) { |
| 217 |
|
$logger->error('EVE ESI Error: ' . $e->getMessage()); |
| 218 |
|
$url = "https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={$systemID}"; |
| 219 |
|
$xml = makeApiRequest($url); |
| 220 |
|
foreach ($xml->result->rowset->row as $entity) { |
| 221 |
|
$name = $entity->attributes()->name; |
| 222 |
|
} |
| 223 |
|
} |
| 224 |
|
|
| 225 |
|
return $name; |
| 226 |
|
} |
| 227 |
|
|
| 228 |
|
/** |
| 229 |
|
* @param string $corpName |
|
@@ 328-360 (lines=33) @@
|
| 325 |
|
* @return mixed |
| 326 |
|
*/ |
| 327 |
|
////Alliance ID to name via CCP |
| 328 |
|
function allianceName($allianceID) |
| 329 |
|
{ |
| 330 |
|
$logger = new Logger('eveESI'); |
| 331 |
|
$logger->pushHandler(new StreamHandler(__DIR__ . '../../log/libraryError.log', Logger::DEBUG)); |
| 332 |
|
|
| 333 |
|
try { |
| 334 |
|
// Initialize a new request for this URL |
| 335 |
|
$ch = curl_init("https://esi.tech.ccp.is/latest/alliances/{$allianceID}/"); |
| 336 |
|
// Set the options for this request |
| 337 |
|
curl_setopt_array($ch, array( |
| 338 |
|
CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect |
| 339 |
|
CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data |
| 340 |
|
CURLOPT_TIMEOUT => 8, |
| 341 |
|
CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate |
| 342 |
|
)); |
| 343 |
|
// Fetch the data from the URL |
| 344 |
|
$data = curl_exec($ch); |
| 345 |
|
// Close the connection |
| 346 |
|
curl_close($ch); |
| 347 |
|
$data = json_decode($data, TRUE); |
| 348 |
|
$name = (string)$data['alliance_name']; |
| 349 |
|
|
| 350 |
|
} catch (Exception $e) { |
| 351 |
|
$logger->error('EVE ESI Error: ' . $e->getMessage()); |
| 352 |
|
$url = "https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={$allianceID}"; |
| 353 |
|
$xml = makeApiRequest($url); |
| 354 |
|
foreach ($xml->result->rowset->row as $entity) { |
| 355 |
|
$name = $entity->attributes()->name; |
| 356 |
|
} |
| 357 |
|
} |
| 358 |
|
|
| 359 |
|
return $name; |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
/** |
| 363 |
|
* @param string $systemName |
|
@@ 407-439 (lines=33) @@
|
| 404 |
|
* @return mixed |
| 405 |
|
*/ |
| 406 |
|
////TypeID to TypeName via CCP |
| 407 |
|
function apiTypeName($typeID) |
| 408 |
|
{ |
| 409 |
|
$logger = new Logger('eveESI'); |
| 410 |
|
$logger->pushHandler(new StreamHandler(__DIR__ . '../../log/libraryError.log', Logger::DEBUG)); |
| 411 |
|
|
| 412 |
|
try { |
| 413 |
|
// Initialize a new request for this URL |
| 414 |
|
$ch = curl_init("https://esi.tech.ccp.is/latest/universe/types/{$typeID}/"); |
| 415 |
|
// Set the options for this request |
| 416 |
|
curl_setopt_array($ch, array( |
| 417 |
|
CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect |
| 418 |
|
CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data |
| 419 |
|
CURLOPT_TIMEOUT => 8, |
| 420 |
|
CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate |
| 421 |
|
)); |
| 422 |
|
// Fetch the data from the URL |
| 423 |
|
$data = curl_exec($ch); |
| 424 |
|
// Close the connection |
| 425 |
|
curl_close($ch); |
| 426 |
|
$data = json_decode($data, TRUE); |
| 427 |
|
$name = (string)$data['type_name']; |
| 428 |
|
|
| 429 |
|
} catch (Exception $e) { |
| 430 |
|
$logger->error('EVE ESI Error: ' . $e->getMessage()); |
| 431 |
|
$url = "https://api.eveonline.com/eve/TypeName.xml.aspx?ids={$typeID}"; |
| 432 |
|
$xml = makeApiRequest($url); |
| 433 |
|
foreach ($xml->result->rowset->row as $entity) { |
| 434 |
|
$name = $entity->attributes()->typeName; |
| 435 |
|
} |
| 436 |
|
} |
| 437 |
|
|
| 438 |
|
return $name; |
| 439 |
|
} |
| 440 |
|
|
| 441 |
|
/** |
| 442 |
|
* @param string $typeName |