private function Client::responseFor in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/vendor/geoip2/geoip2/src/WebService/Client.php \GeoIp2\WebService\Client::responseFor()
3 calls to Client::responseFor()
- Client::city in includes/
vendor/ geoip2/ geoip2/ src/ WebService/ Client.php - This method calls the GeoIP2 Precision: City service.
- Client::country in includes/
vendor/ geoip2/ geoip2/ src/ WebService/ Client.php - This method calls the GeoIP2 Precision: Country service.
- Client::insights in includes/
vendor/ geoip2/ geoip2/ src/ WebService/ Client.php - This method calls the GeoIP2 Precision: Insights service.
File
- includes/
vendor/ geoip2/ geoip2/ src/ WebService/ Client.php, line 192
Class
- Client
- This class provides a client API for all the GeoIP2 Precision web services. The services are Country, City, and Insights. Each service returns a different set of data about an IP address, with Country returning the least data and Insights the most.
Namespace
GeoIp2\WebServiceCode
private function responseFor($endpoint, $class, $ipAddress) {
$path = implode('/', array(
self::$basePath,
$endpoint,
$ipAddress,
));
try {
$body = $this->client
->get('GeoIP2 ' . $class, $path);
} catch (\MaxMind\Exception\IpAddressNotFoundException $ex) {
throw new AddressNotFoundException($ex
->getMessage(), $ex
->getStatusCode(), $ex);
} catch (\MaxMind\Exception\AuthenticationException $ex) {
throw new AuthenticationException($ex
->getMessage(), $ex
->getStatusCode(), $ex);
} catch (\MaxMind\Exception\InsufficientFundsException $ex) {
throw new OutOfQueriesException($ex
->getMessage(), $ex
->getStatusCode(), $ex);
} catch (\MaxMind\Exception\InvalidRequestException $ex) {
throw new InvalidRequestException($ex
->getMessage(), $ex
->getErrorCode(), $ex
->getStatusCode(), $ex
->getUri(), $ex);
} catch (\MaxMind\Exception\HttpException $ex) {
throw new HttpException($ex
->getMessage(), $ex
->getStatusCode(), $ex
->getUri(), $ex);
} catch (\MaxMind\Exception\WebServiceException $ex) {
throw new GeoIp2Exception($ex
->getMessage(), $ex
->getCode(), $ex);
}
$class = "GeoIp2\\Model\\" . $class;
return new $class($body, $this->locales);
}