-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_ip_details.php
41 lines (37 loc) · 1.22 KB
/
get_ip_details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$ipAddress = $_GET['ip'];
// Make API request to get IP details
$response = file_get_contents("http://ip-api.com/json/{$ipAddress}");
$details = json_decode($response, true);
// Prepare the response data
$result = [
'status' => $details['status'],
'message' => $details['message'],
'continent' => $details['continent'],
'continentCode' => $details['continentCode'],
'country' => $details['country'],
'countryCode' => $details['countryCode'],
'region' => $details['region'],
'regionName' => $details['regionName'],
'city' => $details['city'],
'district' => $details['district'],
'zip' => $details['zip'],
'lat' => $details['lat'],
'lon' => $details['lon'],
'timezone' => $details['timezone'],
'offset' => $details['offset'],
'currency' => $details['currency'],
'Data center' => $details['isp'],
'org' => $details['org'],
'as' => $details['as'],
'asname' => $details['asname'],
'reverse' => $details['reverse'],
'mobile' => $details['mobile'],
'proxy' => $details['proxy'],
'hosting' => $details['hosting'],
'query' => $details['query']
];
// Send the response as JSON
header('Content-Type: application/json');
echo json_encode($result);
?>