Page MenuHomePhabricator
Authored By
stwalkerster
Dec 13 2016, 8:55 PM
Size
700 B
Referenced Files
None
Subscribers
None
<?php
$pdo = new PDO('mysql:host=localhost;dbname=stwalkerster_ed_explore', 'stwalkerster', 'fl4smells');
$query = $pdo->query('SELECT * FROM system WHERE x IS NULL OR y IS NULL OR z IS NULL');
$update = $pdo->prepare('UPDATE system SET x = :x, y = :y, z = :z WHERE id = :id');
$systems = $query->fetchAll(PDO::FETCH_ASSOC);
foreach ($systems as $system) {
$data = file_get_contents("https://www.edsm.net/api-v1/system?systemName=" . urlencode($system['name']) . "&coords=1");
if($data === "[]"){
continue;
}
$data = json_decode($data);
$update->execute(array(
':x' => $data->coords->x,
':y' => $data->coords->y,
':z' => $data->coords->z,
':id' => $system['id'],
));
sleep(1);
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5171
Default Alt Text
(700 B)

Event Timeline