Initial commit: Setup Landing Page dan file pertemuan
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
$lat = isset($_GET['lat']) ? floatval($_GET['lat']) : 0;
|
||||
$lng = isset($_GET['lng']) ? floatval($_GET['lng']) : 0;
|
||||
|
||||
if (!$lat || !$lng) {
|
||||
echo json_encode(['error' => 'Koordinat tidak valid']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$url = "https://nominatim.openstreetmap.org/reverse?format=json&lat={$lat}&lon={$lng}&accept-language=id&zoom=18";
|
||||
|
||||
$context = stream_context_create([
|
||||
'http' => [
|
||||
'header' => "User-Agent: WebGIS-Pontianak/1.0\r\n",
|
||||
'timeout' => 10
|
||||
]
|
||||
]);
|
||||
|
||||
$response = @file_get_contents($url, false, $context);
|
||||
|
||||
if ($response === false) {
|
||||
echo json_encode(['error' => 'Gagal menghubungi Nominatim']);
|
||||
exit;
|
||||
}
|
||||
|
||||
echo $response;
|
||||
Reference in New Issue
Block a user