Ping API to test connectivity.

@return object
339415
public static function Ping() {
			try {
				$result = self::MakeStaticRequest( '/v' . FS_API__VERSION . '/ping.json' );
			} catch ( Freemius_Exception $e ) {
				// Map to error object.
				$result = (object) $e->getResult();
			} catch ( Exception $e ) {
				// Map to error object.
				$result = (object) array(
					'error' => array(
						'type'    => 'Unknown',
						'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
						'code'    => 'unknown',
						'http'    => 402
					)
				);
			}

			return $result;
		}
458081
public function ping(int $timeout = 0)
    {
        $source_timeout = $this->curl->timeout;

        $this->curl->setTimeout($timeout);

        $output = $this->curl->get($this->url.'/_ping');

        $this->curl->setTimeout($source_timeout);

        return $output;
    }
942952
public function pingAction()
    {
        $source = $this->getSourceById();

        try {
            if ($source->checkSourceActive($this->currentUser->getUserId())) {
                $this->addMessage($this->_('This installation is active.'), 'success');
            } else {
                $this->addMessage($this->_('Inactive installation.'), 'warning');
            }
        } catch (\Exception $e) {
            $this->addMessage($this->_('Installation error!'), 'danger');
            $this->addMessage($e->getMessage(), 'danger');
        }
        $this->_reroute(array($this->getRequest()->getActionKey() => 'show'));
    }
1304466
public static function ping()
    {
        self::init();

        //====================================================================//
        // Simple Message reply, No Encryption
        Splash::log()->msg("Ping Successful.");
        self::$Outputs->result = true;

        //====================================================================//
        // Transmit Answer with No Encryption
        return Splash::ws()->pack(self::$Outputs, true);
    }
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;
    }
597293
private function pingFsockopen() {
    $start = microtime(true);
    // 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;
  }
1320933
public function getConnection()
    {
        if (! $this->connection) {
            list($dns, $username, $password) = $this->connectionString();

            $this->setConnection(new \PDO($dns, $username, $password));
        }

        return $this->connection;
    }
739180
public function ping($message = null) {
        return $this->returnCommand(['PING'], null, isset($message) ? [$message] : null);
    }
924868
public static function get()
    {
        $possibleKeys = [
            'HTTP_X_FORWARDED_FOR',
            'HTTP_X_FORWARDED',
            'HTTP_X_CLUSTER_CLIENT_IP',
            'HTTP_FORWARDED_FOR',
            'HTTP_FORWARDED',
            'HTTP_VIA',
            'HTTP_X_COMING_FROM',
            'HTTP_COMING_FROM',
            'HTTP_X_REAL_IP',
            'REMOTE_ADDR',
        ];

        foreach ($possibleKeys as $key) {
            if ($ip = static::getGlobalValue($key)) {
                return $ip;
            }
        }

        return false;
    }
1189883
public function isWorking()
    {
        // test with an example IP to make sure the provider is working
        // NOTE: At the moment only country, region & city info is tested.
        try {
            $supportedInfo = $this->getSupportedLocationInfo();

            list($testIp, $expectedResult) = self::getTestIpAndResult();

            // get location using test IP
            $location = $this->getLocation(array('ip' => $testIp));

            // check that result is the same as expected
            $isResultCorrect = true;
            foreach ($expectedResult as $key => $value) {
                // if this provider is not configured to support this information type, skip it
                if (empty($supportedInfo[$key])) {
                    continue;
                }

                if (empty($location[$key])
                    || $location[$key] != $value
                ) {
                    $isResultCorrect = false;
                }
            }

            if (!$isResultCorrect) {
                $unknown = Piwik::translate('General_Unknown');

                $location = "'"
                    . (empty($location[self::CITY_NAME_KEY]) ? $unknown : $location[self::CITY_NAME_KEY])
                    . ", "
                    . (empty($location[self::REGION_CODE_KEY]) ? $unknown : $location[self::REGION_CODE_KEY])
                    . ", "
                    . (empty($location[self::COUNTRY_CODE_KEY]) ? $unknown : $location[self::COUNTRY_CODE_KEY])
                    . "'";

                $expectedLocation = "'" . $expectedResult[self::CITY_NAME_KEY] . ", "
                    . $expectedResult[self::REGION_CODE_KEY] . ", "
                    . $expectedResult[self::COUNTRY_CODE_KEY] . "'";

                $bind = array($testIp, $location, $expectedLocation);
                return Piwik::translate('UserCountry_TestIPLocatorFailed', $bind);
            }

            return true;
        } catch (Exception $ex) {
            return $ex->getMessage();
        }
    }
371704
public static function getIPAddress()
    {
        if (isset($_SERVER['HTTP_CLIENT_IP'])) {
            return $_SERVER['HTTP_CLIENT_IP'];
        } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            ///to check ip is pass from proxy
            return $_SERVER['HTTP_X_FORWARDED_FOR'];
        } elseif (isset($_SERVER['REMOTE_ADDR'])) {
            return $_SERVER['REMOTE_ADDR'];
        }

        return null;
    }
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;
	}
243827
public function ping()
    {
        Debug::Log(Debug::INFO, 'ping()');
        $this->simpleCommand(Message::PINGREQ);

        $this->ping_queue[] = time();

        return count($this->ping_queue);
    }
272332
function ping() {
        result = fn.apply(context || this, args || []);
        context = args = null;
        executed = true;
      }
607680
function ip() {
		$headers=$this->hive['HEADERS'];
		return isset($headers['Client-IP'])?
			$headers['Client-IP']:
			(isset($headers['X-Forwarded-For'])?
				explode(',',$headers['X-Forwarded-For'])[0]:
				(isset($_SERVER['REMOTE_ADDR'])?
					$_SERVER['REMOTE_ADDR']:''));
	}
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;
    }
483380
public function Ping( )
		{
			if( !$this->Connected )
			{
				throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
			}
			
			$this->Socket->Write( self::A2S_PING );
			$Buffer = $this->Socket->Read( );
			
			return $Buffer->GetByte( ) === self::S2A_PING;
		}