![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/IpLookup/ |
<?php namespace Mautic\CoreBundle\IpLookup; class GeoipsLookup extends AbstractRemoteDataLookup { public string $continent_name = ''; public string $continent_code = ''; public string $country_code = ''; public string $region_code = ''; public string $county_name = ''; public function getAttribution(): string { return '<a href="http://www.geoips.com/" target="_blank">GeoIPs</a> offers tiered subscriptions for lookups.'; } protected function getUrl(): string { return "http://api.geoips.com/ip/{$this->ip}/key/{$this->auth}/output/json"; } protected function parseResponse($response) { $data = json_decode($response); if ($data && !empty($data->response->location)) { foreach ($data->response->location as $key => $value) { switch ($key) { case 'city_name': $key = 'city'; break; case 'region_name': $key = 'region'; break; case 'country_name': $key = 'country'; break; case 'owner': $key = 'isp'; break; } $this->$key = $value; } } } }