File: /var/www/html/chatbot-elan/test.php
<?php
$ip = "49.36.179.98";
// API with IP address
$url = "http://www.geoplugin.net/json.gp?ip=".$ip;
// get a requested data
$userInfo = file_get_contents($url);
// convert JSON to array
$result = json_decode($userInfo,true);
// you can print the array to see the all information
// echo "<pre>";
// print_r($result);
echo "<b>IP Address : </b>".$result['geoplugin_request']."<br>";
echo "<b>City : </b>".$result['geoplugin_city']."<br>";
echo "<b>State : </b>".$result['geoplugin_regionName']."<br>";
echo "<b>Country : </b>".$result['geoplugin_countryName']."<br>";
echo "<b>Country Code : </b>".$result['geoplugin_countryCode']."<br>";
echo "<b>Latitude : </b>".$result['geoplugin_latitude']."<br>";
echo "<b>Longitude : </b>".$result['geoplugin_longitude']."<br>";
echo "<b>Timezone : </b>".$result['geoplugin_timezone'];
?>