Page MenuHomePhabricator

(An Untitled Masterwork)
ActivePublic

Authored by stwalkerster on Dec 13 2016, 8:55 PM.
Tags
None
Referenced Files
F5956:
Dec 13 2016, 8:55 PM
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);
}

Event Timeline

import-bot changed the edit policy from "All Users" to "Community (Project)".Feb 3 2017, 3:03 PM