Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
- Remove this if you use the .htaccess -->
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title>IP Geolocation</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width; initial-scale=1.0">
- <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
- <link rel="shortcut icon" href="/favicon.ico">
- <link rel="apple-touch-icon" href="/apple-touch-icon.png">
- <link rel="stylesheet" href="css/flags.css" />
- </head>
- <body>
- <div>
- <header>
- <h1>IP Geolocation</h1>
- </header>
- <div>
- <?php
- $temp_ip = '173.252.120.6,202.146.4.100,173.194.38.132,27.111.43.209,98.139.183.24,203.190.241.43,72.52.91.14';
- $temp_pecah = explode(',', $temp_ip);
- //var_dump($temp_pecah);
- foreach ($temp_pecah as $key) {
- $dump = json_decode(file_get_contents("http://ipinfo.io/{$key}"));
- //var_dump($details);
- echo "IP Address: ".$dump->ip."<br />";
- echo "Hostname: ".$dump->hostname."<br />";
- echo "City: ".$dump->city."<br />";
- echo "Region: ".$dump->region."<br />";
- echo "Country: <img src=\"img/blank.gif\" class=\"flag flag-".strtolower($dump->country)."\"><br />";
- echo "Location: ".$dump->loc."<br />";
- echo "Network: ".$dump->org."<br />";
- if (empty($dump->postal)) {
- echo "Postal Code: -<br /><hr />";
- } else {
- echo "Postal Code: ".$dump->postal."<br /><hr />";
- }
- }
- ?>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement