You are here

public function Client::city in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 includes/vendor/geoip2/geoip2/src/WebService/Client.php \GeoIp2\WebService\Client::city()

This method calls the GeoIP2 Precision: City service.

Parameters

string $ipAddress IPv4 or IPv6 address as a string. If no: address is provided, the address that the web service is called from will be used.

Return value

\GeoIp2\Model\City

Throws

\GeoIp2\Exception\AddressNotFoundException if the address you provided is not in our database (e.g., a private address).

\GeoIp2\Exception\AuthenticationException if there is a problem with the user ID or license key that you provided.

\GeoIp2\Exception\OutOfQueriesException if your account is out of queries.

\GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is invalid for some other reason. This may indicate an issue with this API. Please report the error to MaxMind.

\GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned. This could indicate a problem with the connection between your server and the web service or that the web service returned an invalid document or 500 error code.

\GeoIp2\Exception\GeoIp2Exception This serves as the parent class to the above exceptions. It will be thrown directly if a 200 status code is returned but the body is invalid.

Overrides ProviderInterface::city

File

includes/vendor/geoip2/geoip2/src/WebService/Client.php, line 123

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\WebService

Code

public function city($ipAddress = 'me') {
  return $this
    ->responseFor('city', 'City', $ipAddress);
}