Problemas con geoip Php

Buenos días… Me gustaría que me colaboraran con lo siguiente, tengo el siguiente código php para registrar el IP, al ejecutarlo en xampp arroja los resultados correctos pero al ejecutar desde 000webhost arroja un resultado diferente. Muchas gracias

<?php $json = file_get_contents('https://geoip-db.com/jsonp'); echo $json; ?>

Can you use curl instead?

ya lo use y no funcionó.
$cliente = curl_init();
curl_setopt($cliente, CURLOPT_URL, “https://geoip-db.com/jsonp/”);
curl_setopt($cliente, CURLOPT_HEADER, 0);
curl_exec($cliente);
curl_close($cliente);

Hmm what is the expected result? The visiting user by any chance?

<!DOCTYPE html>
<html>
<head>
    <title>GEOIP DB - jQuery example</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
    <div>Country: <span id="country"></span></div>
    <div>State: <span id="state"></span></div>
    <div>City: <span id="city"></span></div>
    <div>Latitude: <span id="latitude"></span></div>
    <div>Longitude: <span id="longitude"></span></div>
    <div>IP: <span id="ipv4"></span></div>
    <script>
	$.ajax({
		url: "https://geoip-db.com/jsonp",
		jsonpCallback: "callback",
		dataType: "jsonp",
		success: function( location ) {
			$('#country').html(location.country_name);
			$('#state').html(location.state);
			$('#city').html(location.city);
			$('#latitude').html(location.latitude);
			$('#longitude').html(location.longitude);
			$('#ipv4').html(location.IPv4);  
		}
	});		
    </script>
</body>
</html>

Provides the visiting user information.

Your original code just provides the server information seemingly.

cuando lo ejecuto en xampp este es el resultado:
CO
Colombia
Antioquia
Medellín
050021
6.2518
-75.5636
181.129.30.250

pero al ejecutarlo en 000webhost el resultado es el siguiente:
US
United States
:37.751,
-97.822,
“153.92.0.4”

Top being your local address?
Bottom being our local server address?

tengo el php en el servidor 000webhost cuando lo ejecuto genera la ubicación en Estados Unidos.

That is where the sever is yes :slight_smile: