Ping site factory.

@return string
518021
public function ping()
    {
        if ($this->getURL() === null) {
            return 'Cannot find site URL from configuration.';
        }
        $url = $this->getURL().'/api/v1/ping';
        $params = [];
        $response = $this->connecting($url, $params, 'GET');

        if (isset($response->message)) {
            return $response->message;
        }

        return $response;
    }
1075602
public function getHost()
    {
        if (! $this->host) {
            $this->host = UriSchemeFactory::make() . '://' . UriHostFactory::make();
        }

        return $this->host;
    }
938667
public function getUrlBase() : string
    {
        $url = sprintf('%s://%s', $this->getScheme(), $this->host);
        $isStandardPort = ($this->port === ($this->isSecure ? 443 : 80));

        return $isStandardPort ? $url : $url . ':' . $this->port;
    }
459411
protected function createPing()
    {
        if (!isset($this->host)) {
            throw new \InvalidArgumentException(
                'Missing hostname, unable to conduct a ping request.'
            );
        }

        return new Ping($this->host, $this->ttl, $this->timeout);
    }
656333
public function getProbes()
	{
		$client = new \Guzzle\Service\Client('https://api.pingdom.com/api/2.0');

		/** @var $request \Guzzle\Http\Message\Request */
		$request = $client->get('probes', array('App-Key' => $this->token));
		$request->setAuth($this->username, $this->password);
		$response = $request->send();
		$response = json_decode($response->getBody(), true);
		$probes   = array();

		foreach ($response['probes'] as $attributes) {
			$probes[] = new Probe\Server($attributes);
		}

		return $probes;
	}
840605
public static function IP(){
   switch(true){
     case !empty($_SERVER['HTTP_X_FORWARDED_FOR']):
       $ip = trim(substr(strrchr($_SERVER['HTTP_X_FORWARDED_FOR'],','),1) ?: $_SERVER['HTTP_X_FORWARDED_FOR']);
     break;
     case !empty($_SERVER['HTTP_X_FORWARDED_HOST']):
       $ip = trim(substr(strrchr($_SERVER['HTTP_X_FORWARDED_HOST'],','),1) ?: $_SERVER['HTTP_X_FORWARDED_HOST']);
     break;
     case !empty($_SERVER['REMOTE_ADDR']):    $ip = $_SERVER['REMOTE_ADDR']; break;
     case !empty($_SERVER['HTTP_CLIENT_IP']): $ip = $_SERVER['HTTP_CLIENT_IP']; break;
     default:                                 $ip = ''; break;
   }
   return Filter::with('core.request.IP',$ip);
  }
93651
public static function getLocalIP() {
        $s = &$_SERVER;

        $ipAddress = $s['REMOTE_ADDR'];

        if (array_key_exists('HTTP_X_FORWARDED_FOR', $s)) {
            $temp = explode(',', $s['HTTP_X_FORWARDED_FOR']);
            $ipAddress = array_pop($temp);
        }

        $result = $ipAddress == '::1' ? "127.0.0.1" : $ipAddress;

        return $result;
    }
363343
public function ping()
    {
        try {
            $this->connect();
            $this->pdo->query('select 1')->fetchColumn();
        } catch (\PDOException $e) {
            if (strpos($e->getMessage(), 'server has gone away') !== false) {
                return false;
            }
        }

        return true;
    }
852478
public function getIp(){
		if( (int) $this->lastCheck > 0 && time() - $this->lastCheck < 10 * 60 )
			return $this->lastIp;
		$this->reader->setUrl( 'http://checkip.dyndns.org' );
		$html	= $this->reader->read();
		$parts	= explode( ": ", strip_tags( $html ) );
		$ip		= trim( array_pop( $parts ) );
		$this->save( array( 'ip' => $ip, 'timestamp' => time() ) );
		return $ip;
	}
333095
protected function vhost()
	{
		$host = rtrim($_SERVER['HTTP_HOST']);
		if (empty($host))
		{
			$host = $_SERVER['SERVER_NAME'];
		}
		$host  = preg_replace('/[^A-Za-z0-9\[\]\.:-]/', '', $host);
		
		if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) 
		{
			$xhost = preg_replace('/[^A-Za-z0-9\[\]\.:-]/', '', rtrim($_SERVER['HTTP_X_FORWARDED_HOST'],'/'));
		} 
		else 
		{
			$xhost = '';
		}
		
		return (!empty($xhost) ? $xhost : $host) ;
	}
1164669
protected function _getShopHostInfoFromServerVars()
    {
        // got here from setup dir
        $sScript = $_SERVER['SCRIPT_NAME'];
        $iPort = (int) $_SERVER['SERVER_PORT'];
        $blSsl = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on'));
        if (!$iPort) {
            $iPort = $blSsl ? 443 : 80;
        }
        $sScript = rtrim(dirname(dirname($sScript)), '/') . '/';

        return [
            'host' => $_SERVER['HTTP_HOST'],
            'port' => $iPort,
            'dir'  => $sScript,
            'ssl'  => $blSsl,
        ];
    }
1348897
public function getIp(): string
    {
        if ($this->ip === null) {
            foreach (["HTTP_X_FORWARDED_FOR", "X_FORWARDED_FOR"] as $key) {
                $proxyIpList = $this->environment[$key] ?? "";
                if ($proxyIpList) {
                    $commaPosition = strpos($proxyIpList, ",");
                    if ($commaPosition !== false) {
                        $this->ip = substr($proxyIpList, 0, $commaPosition);
                    } else {
                        $this->ip = $proxyIpList;
                    }
                    return $this->ip;
                }
            }
            $this->ip = $this->environment["REMOTE_ADDR"] ?? "";
        }
        return $this->ip;
    }
672932
public static function siteBaseUrl()
    {
        $base_url = self::requestInstance()->getDeterminedScheme().'://'.self::requestInstance()->getServerName().':'.self::requestInstance()->getServerPort().self::getBase();

        return $base_url;
    }
135160
private function getCustomerIP()
    {
        $ip = null;
        if(array_key_exists('X-Forwarded-For', $_SERVER)) {
            $ip = $_SERVER['X-Forwarded-For'];
        } elseif(array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } elseif(array_key_exists('REMOTE_ADDR', $_SERVER)) {
            $ip = $_SERVER['REMOTE_ADDR'];
        }

        return $ip;
    }
623585
protected function assembleHost() {
		if ($this->host === null) {
			return '/';
		}
		
		if ($this->port === null) {
			return $this->host;
		}
		
		return $this->host . ':' . $this->port;
	}
518947
private function pingFsockopen() {
        $start = microtime(true);

        if (strtolower($this->typeCon) != 'tcp') {
            $this->setPort(7);
            $this->setHost("udp://$this->host");
        }

        // fsockopen prints a bunch of errors if a host is unreachable. Hide those
        // irrelevant errors and deal with the results instead.
        $fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
        if (!$fp) {
            $latency = false;
        } else {
            $latency = microtime(true) - $start;
            $latency = round($latency * 1000);
        }
        return $latency;
    }
883651
public function baseUrl()
    {
        if (isset($this->baseUrl)) {
            return $this->baseUrl;
        }

        $config = $this->getPackageConfig();

        if (isset($config['baseUrl'])) {
            return $config['baseUrl'];
        }

        return 'http://localhost:8888';
    }