IP Information
This tool provides detailed geographical and ISP information for a given IP address using the GeoIP2.
city($_GET['ip']);
$records2 = $reader2->asn($_GET['ip']);
// var_dump($records2);
$country = $records->country->name ?? null;
$state = $records->mostSpecificSubdivision->name ?? null;
$city = $records->city->name ?? null;
$region = $records->subdivisions[0]->name ?? null;
$timezone = $records->location->timeZone ?? null;
$data = [
'ip' => $_GET['ip'],
'country' => $records->country->name ?? null,
'country_iso_code' => $records->country->iso_code ?? null,
'state' => $records->mostSpecificSubdivision->name ?? null,
'state_iso_code' => $records->mostSpecificSubdivision->iso_code ?? null,
'city' => $records->city->name ?? null,
'region' => $records->subdivisions[0]->name ?? null,
'timezone' => $records->location->timeZone ?? null,
'latitude' => $records->location->latitude ?? null,
'longitude' => $records->location->longitude ?? null,
'postal_code' => $records->postal->code ?? null,
'continent' => $records->continent->name ?? null,
'asn' => $records2->autonomousSystemNumber ?? null,
'isp' => $records2->autonomousSystemOrganization ?? null,
];
$dataArray = [$data]; // Wrap in an array if it's a single record.
?>
IP:
Continent:
Country:
State:
City:
Region:
Timezone:
Latitude:
Longitude:
Postal Code:
ASN:
ISP:
Invalid data format
';
echo '
';
}
}
?>
$e->getMessage()]);
echo '';
}
} else {
?>
Usage:
- Enter IP Address: Input the IP address you wish to check in the provided query parameter.
- Check Location: Send a request with the IP address to retrieve and display the geographical and ISP information.
- View Results: The location and ISP details will be displayed in a structured format, showing country, city, region, ASN, ISP, and other relevant information.
Features:
- Uses MaxMind GeoLite2 databases for accurate geo-location and ISP information.
- Displays detailed geographical information including continent, country, state, city, and region.
- Provides additional information such as timezone, latitude, longitude, and postal code.
- Displays Autonomous System Number (ASN) and Internet Service Provider (ISP) details.
Example Use Cases:
- Network administrators tracking the location of IP addresses accessing their networks.
- Security professionals analyzing IP addresses for potential threats.
- Developers building applications that require IP-based location services.
- Marketers tailoring content based on the geographic location of their audience.