Start Codeschnipsel PHP IP-Adresse + Geolocation

IP-Adresse + Geolocation

IP-Adresse + Geolocation

<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "Deine IP: $ip";

// API für GeoIP
$json = file_get_contents("http://ip-api.com/json/$ip");
$geo = json_decode($json, true);
echo " Land: " . $geo["country"];
?>

Keine Kommentare

Die mobile Version verlassen