Skip to content

Instantly share code, notes, and snippets.

@Khazl
Last active December 7, 2017 14:32
Show Gist options
  • Save Khazl/226dda155561786bfa79a60c484b828b to your computer and use it in GitHub Desktop.
Save Khazl/226dda155561786bfa79a60c484b828b to your computer and use it in GitHub Desktop.
Ores API
<?php
$today = date("Y-m-d");
$file = "archive/".$today.".json";
if (!file_exists($file)) {
$ores = [
18 => 'Plagioclase',
19 => 'Spodumain',
20 => 'Kernite',
21 => 'Hedbergite',
22 => 'Arkonor',
34 => 'Tritanium',
35 => 'Pyerite',
36 => 'Mexallon',
37 => 'Isogen',
38 => 'Nocxium',
39 => 'Zydrine',
40 => 'Megacyte',
1223 => 'Bistot',
1224 => 'Pyroxeres',
1225 => 'Crokite',
1226 => 'Jaspet',
1227 => 'Omber',
1228 => 'Scordite',
1229 => 'Gneiss',
1230 => 'Veldspar',
1231 => 'Hemorphite',
1232 => 'Dark Ochre',
16262 => 'Clear Icicle',
16263 => 'Glacial Mass',
16264 => 'Blue Ice',
16265 => 'White Glaze',
16266 => 'Glare Crust',
16267 => 'Dark Glitter',
16268 => 'Gelidus',
16269 => 'Krystallos',
16272 => 'Heavy Water',
16273 => 'Liquid Ozone',
16274 => 'Helium Isotopes',
16275 => 'Strontium Clathrates',
17425 => 'Crimson Arkonor',
17426 => 'Prime Arkonor',
17428 => 'Triclinic Bistot',
17429 => 'Monoclinic Bistot',
17432 => 'Sharp Crokite',
17433 => 'Crystalline Crokite',
17436 => 'Onyx Ochre',
17437 => 'Obsidian Ochre',
17440 => 'Vitric Hedbergite',
17441 => 'Glazed Hedbergite',
17444 => 'Vivid Hemorphite',
17445 => 'Radiant Hemorphite',
17448 => 'Pure Jaspet',
17449 => 'Pristine Jaspet',
17452 => 'Luminous Kernite',
17453 => 'Fiery Kernite',
17455 => 'Azure Plagioclase',
17456 => 'Rich Plagioclase',
17459 => 'Solid Pyroxeres',
17460 => 'Viscous Pyroxere',
17463 => 'Condensed Scordite',
17464 => 'Massive Scordite',
17466 => 'Bright Spodumain',
17467 => 'Gleaming Spodumain',
17470 => 'Concentrated Veldspar',
17471 => 'Dense Veldspar',
17865 => 'Iridescent Gneiss',
17866 => 'Prismatic Gneiss',
17867 => 'Silvery Omber',
17868 => 'Golden Omber',
11396 => 'Mercoxit',
11399 => 'Morphite',
17869 => 'Magma Mercoxit',
17870 => 'Vitreous Mercoxit',
17978 => 'Enriched Clear Icicle',
17977 => 'Smooth Glacial Mass',
17975 => 'Thick Blue Ice',
17976 => 'Pristine White Glaze',
28367 => 'Compressed Arkonor',
28385 => 'Compressed Crimson Arkonor',
28387 => 'Compressed Prime Arkonor',
28388 => 'Compressed Bistot',
28389 => 'Compressed Monoclinic Bistot',
28390 => 'Compressed Triclinic Bistot',
28391 => 'Compressed Crokite',
28392 => 'Compressed Crystalline Crokite',
28393 => 'Compressed Sharp Crokite',
28394 => 'Compressed Dark Ochre',
28395 => 'Compressed Obsidian Ochre',
28396 => 'Compressed Onyx Ochre',
28397 => 'Compressed Gneiss',
28398 => 'Compressed Iridescent Gneiss',
28399 => 'Compressed Prismatic Gneiss',
28400 => 'Compressed Glazed Hedbergite',
28401 => 'Compressed Hedbergite',
28402 => 'Compressed Vitric Hedbergite',
28403 => 'Compressed Hemorphite',
28404 => 'Compressed Radiant Hemorphite',
28405 => 'Compressed Vivid Hemorphite',
28406 => 'Compressed Jaspet',
28407 => 'Compressed Pristine Jaspet',
28408 => 'Compressed Pure Jaspet',
28409 => 'Compressed Fiery Kernite',
28410 => 'Compressed Kernite',
28411 => 'Compressed Luminous Kernite',
28412 => 'Compressed Magma Mercoxit',
28413 => 'Compressed Mercoxit',
28414 => 'Compressed Vitreous Mercoxit',
28415 => 'Compressed Golden Omber',
28416 => 'Compressed Omber',
28417 => 'Compressed Silvery Omber',
28418 => 'Compressed Bright Spodumain',
28419 => 'Compressed Gleaming Spodumain',
28420 => 'Compressed Spodumain',
28421 => 'Compressed Azure Plagioclase',
28422 => 'Compressed Plagioclase',
28423 => 'Compressed Rich Plagioclase',
28424 => 'Compressed Pyroxeres',
28425 => 'Compressed Solid Pyroxeres',
28426 => 'Compressed Viscous Pyroxeres',
28427 => 'Compressed Condensed Scordite',
28428 => 'Compressed Massive Scordite',
28429 => 'Compressed Scordite',
28430 => 'Compressed Concentrated Veldspar',
28431 => 'Compressed Dense Veldspar',
28432 => 'Compressed Veldspar',
28433 => 'Compressed Blue Ice',
28434 => 'Compressed Clear Icicle',
28435 => 'Compressed Dark Glitter',
28436 => 'Compressed Enriched Clear Icicle',
28437 => 'Compressed Gelidus',
28438 => 'Compressed Glacial Mass',
28439 => 'Compressed Glare Crust',
28440 => 'Compressed Krystallos',
28441 => 'Compressed Pristine White Glaze',
28442 => 'Compressed Smooth Glacial Mass',
28443 => 'Compressed Thick Blue Ice',
28444 => 'Compressed White Glaze'
];
$result = file_get_contents("https://esi.tech.ccp.is/latest/markets/prices/?datasource=tranquility", false);
$jsonResult = json_decode($result, true);
$oreMarket = [];
foreach ($jsonResult as $marketEntry) {
if (array_key_exists($marketEntry['type_id'], $ores)) {
$typeId = $marketEntry['type_id'];
unset($marketEntry['type_id']);
$oreMarket[$typeId] = $marketEntry;
}
}
file_put_contents($file, json_encode($oreMarket));
}
header('Content-Type: application/json');
readfile($file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment