Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5956
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
stwalkerster
Dec 13 2016, 8:55 PM
2016-12-13 20:55:14 (UTC+0)
Size
700 B
Referenced Files
None
Subscribers
None
View Options
<?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
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5171
Default Alt Text
(700 B)
Attached To
Mode
P82 (An Untitled Masterwork)
Attached
Detach File
Event Timeline
Log In to Comment