@@ -114,21 +114,30 @@ Here is an example to get the geolocation for a list of IP addresses and display
114114 $decodedLocation = json_decode($location, true);
115115
116116 echo "<tr >";
117- echo "<td >".$decodedLocation['ip']."</td >";
118- echo "<td >".$decodedLocation['continent_name']." (".$decodedLocation['continent_code'].")</td >";
119- echo "<td >".$decodedLocation['country_name']." (".$decodedLocation['country_code2'].")</td >";
120- echo "<td >".$decodedLocation['organization']."</td >";
121- echo "<td >".$decodedLocation['isp']."</td >";
122- echo "<td >".$decodedLocation['languages']."</td >";
123- if($decodedLocation['is_eu'] == true) {
124- echo "<td >Yes</td >";
117+
118+ if ($decodedLocation['message'] != '') {
119+ echo "<td >".$ip."</td >";
120+ echo "<td >".$decodedLocation['message']."</td >";
125121 } else {
126- echo "<td >No</td >";
122+ echo "<td >".$decodedLocation['ip']."</td >";
123+ echo "<td >".$decodedLocation['continent_name']." (".$decodedLocation['continent_code'].")</td >";
124+ echo "<td >".$decodedLocation['country_name']." (".$decodedLocation['country_code2'].")</td >";
125+ echo "<td >".$decodedLocation['organization']."</td >";
126+ echo "<td >".$decodedLocation['isp']."</td >";
127+ echo "<td >".$decodedLocation['languages']."</td >";
128+
129+ if ($decodedLocation['is_eu'] == true) {
130+ echo "<td >Yes</td >";
131+ } else {
132+ echo "<td >No</td >";
133+ }
134+
135+ echo "<td >".$decodedLocation['currency']['name']."</td >";
136+ echo "<td >".$decodedLocation['time_zone']['name']."</td >";
127137 }
128- echo "<td >".$decodedLocation['currency']['name']."</td >";
129- echo "<td >".$decodedLocation['time_zone']['name']."</td >";
130138 echo "</tr >";
131139 }
140+
132141 echo "</table >";
133142
134143 function get_geolocation($apiKey, $ip, $lang = "en", $fields = "*", $excludes = "") {
0 commit comments