getClientIps() public static method

In the returned array the most trusted IP address is first, and the least trusted one last. The "real" client IP address is the last one, but this is also the least trusted one. Trusted proxies are stripped. Use this method carefully; you should use getClientIp() instead.
See also: getClientIp()
public static getClientIps ( ) : array
return array The client IP addresses
Ejemplo n.º 1
0
 public function getEventData()
 {
     // timestamp
     $timestamp = Carbon::now()->timestamp;
     $actor_id = $this->actor;
     $source_ip = \Request::getClientIps();
     $port = \Request::getPort();
     $duration = 'unknown';
 }
Ejemplo n.º 2
0
 /**
  * Returns an array, indexed by provider name, of telemetry data gathered during the period defined by $start to $end
  *
  * @param string|array|null $providers The providers to query
  * @param string|int|null   $start     The period start (greater or equal to >=). Null == today
  * @param string|int|null   $end       The period end (less than <). Null == today
  * @param bool              $store     If true, the response is stored for posterity
  *
  * @return array
  */
 public function getTelemetry($providers = null, $start = null, $end = null, $store = true)
 {
     $_providers = $providers ?: $this->providers;
     is_string($_providers) && ($_providers = [$_providers]);
     //  Identify our data
     $_telemetry = ['_meta' => ['source-uri' => config('app.url', \Request::getSchemeAndHttpHost()), 'request-timestamp' => Carbon::now(), 'request-host' => 'cli' == PHP_SAPI ? 'localhost' : \Request::getSchemeAndHttpHost(), 'request-ip' => 'cli' == PHP_SAPI ? ['127.0.0.1'] : \Request::getClientIps()]];
     foreach ($_providers as $_provider) {
         $_telemetry[$_provider] = $this->make($_provider)->getTelemetry();
     }
     $store && Telemetry::storeTelemetry(TelemetryServiceProvider::IOC_NAME, $_telemetry);
     return is_string($providers) ? current($_telemetry) : $_telemetry;
 }