Provider: 18-97-14-90.crawl.commoncrawl.org
Landnaam: United States Stad: Ashburn Continent: North America Latitude: 39.0469 Longitude: -77.4903 Currency Symbol: $ Currency Code: USD Timezone: America/New_York
<?php
// provider
$provider = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo "Provider: $provider";
// PHP code to extract IP
function getVisIpAddr() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
}
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else {
return $_SERVER['REMOTE_ADDR'];
}
}
// voorbeeld van:
// https://www.geeksforgeeks.org/how-to-get-visitors-country-from-their-ip-in-php/
// Store the IP address
$ip = getVisIPAddr();
// Display the IP address
//echo $vis_ip;
$ipdat = @json_decode(file_get_contents(
"http://www.geoplugin.net/json.gp?ip=" . $ip));
echo '<pre>';
echo 'Landnaam: ' . $ipdat->geoplugin_countryName . "\n";
echo 'Stad: ' . $ipdat->geoplugin_city . "\n";
echo 'Continent: ' . $ipdat->geoplugin_continentName . "\n";
echo 'Latitude: ' . $ipdat->geoplugin_latitude . "\n";
echo 'Longitude: ' . $ipdat->geoplugin_longitude . "\n";
echo 'Currency Symbol: ' . $ipdat->geoplugin_currencySymbol . "\n";
echo 'Currency Code: ' . $ipdat->geoplugin_currencyCode . "\n";
echo 'Timezone: ' . $ipdat->geoplugin_timezone;
echo '</pre>';
//bronweergeven
show_source(__FILE__);
?>