Verified Commit 44b488b8 authored by Luc Didry's avatar Luc Didry
Browse files

— Add JSON endpoint

parent e3fff5dd
Revision history for GeoIP Lookup
0.3 ????-??-??
0.2 2022-03-29
- add JSON endpoint
0.1 2022-03-29
- first version, working
- private and reserved IP addresses are filtered
......
......@@ -32,6 +32,15 @@
} else {
$description = "Pour voir les infos géographiques d’une adresse IP";
}
if (isset($_GET['json'])) {
header('content-type: application/json; charset=utf-8');
if (isset($err)) {
echo json_encode(['err' => $err]);
} else {
echo json_encode($infos);
}
return;
}
?>
<!DOCTYPE html>
<html lang="en">
......@@ -83,6 +92,9 @@
<form method="GET">
<label for="ip">Adresse IP à rechercher</label>
<input type="text" name="ip" id="ip">
<input type="checkbox" name="json" id="json">
<label for="json">Résultat sous forme de fichier JSON</label>
<br>
<input type="submit">
</form>
</body>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment