You are here

public function Client::__construct in Smart IP 6.2

Same name in this branch
  1. 6.2 includes/vendor/maxmind/web-service-common/src/WebService/Client.php \MaxMind\WebService\Client::__construct()
  2. 6.2 includes/vendor/geoip2/geoip2/src/WebService/Client.php \GeoIp2\WebService\Client::__construct()
Same name and namespace in other branches
  1. 7.2 includes/vendor/maxmind/web-service-common/src/WebService/Client.php \MaxMind\WebService\Client::__construct()

Parameters

int $userId Your MaxMind user ID:

string $licenseKey Your MaxMind license key:

array $options An array of options. Possible keys::

  • `host` - The host to use when connecting to the web service.
  • `userAgent` - The prefix of the User-Agent to use in the request.
  • `caBundle` - The bundle of CA root certificates to use in the request.
  • `connectTimeout` - The connect timeout to use for the request.
  • `timeout` - The timeout to use for the request.
  • `proxy` - The HTTP proxy to use. May include a schema, port, username, and password, e.g., `http://username:password@127.0.0.1:10`.

File

includes/vendor/maxmind/web-service-common/src/WebService/Client.php, line 50

Class

Client
This class is not intended to be used directly by an end-user of a MaxMind web service. Please use the appropriate client API for the service that you are using. @package MaxMind\WebService @internal

Namespace

MaxMind\WebService

Code

public function __construct($userId, $licenseKey, $options = array()) {
  $this->userId = $userId;
  $this->licenseKey = $licenseKey;
  $this->httpRequestFactory = isset($options['httpRequestFactory']) ? $options['httpRequestFactory'] : new RequestFactory();
  if (isset($options['host'])) {
    $this->host = $options['host'];
  }
  if (isset($options['userAgent'])) {
    $this->userAgentPrefix = $options['userAgent'] . ' ';
  }
  $this->caBundle = isset($options['caBundle']) ? $this->caBundle = $options['caBundle'] : $this
    ->getCaBundle();
  if (isset($options['connectTimeout'])) {
    $this->connectTimeout = $options['connectTimeout'];
  }
  if (isset($options['timeout'])) {
    $this->timeout = $options['timeout'];
  }
  if (isset($options['proxy'])) {
    $this->proxy = $options['proxy'];
  }
}