Grab IP from host
http://www.php.net/manual/en/function.gethostbyname.php#78965
@param string $address
@return mixed
7601
public static function lookUpHostIp($address)
    {

        $ipAddress = null;
        if (function_exists('dns_get_record')) {
            $records = dns_get_record(trim($address));
            foreach ($records as $record) {
                if ($record['type'] == 'A') {
                    $ipAddress = $record['ip'];
                }
            }
        }
        return $ipAddress;
    }
1063688
public function getBalanceByAddress($address)
    {
        $args = [
            (string)$address,
            $this->minconf
        ];
        return $this->rpc->query("getReceivedByAddress", $args);
    }
35838
private function justAddress($address)
    {
        if (($pos = strpos($address, '<')) === false) {
            return $address;
        }

        $n = strlen($address);
        if ($address[$n - 1] == '>') {
            $address = substr($address, $pos + 1, -1);
        }

        return $address;
    }
970892
public function getMageRegionByAddress($address)
    {
        $map = $this->getIsoToMagentoMapping();

        $state = preg_replace("/{$address->getCountry()}\-/", "", $address->getState());

        /** @var \Magento\Directory\Model\ResourceModel\Region\Collection $set */
        /** @var \Magento\Directory\Model\Region $region */
        $set    = $this->regionFactory->create()->getCollection();
        $region = $set->addCountryFilter($address->getCountry())
                      ->addFieldToFilter('main_table.code', $state)
                      ->getFirstItem();

        // If no region was found
        if (!$region->getId() && !empty($state) && isset($map[$address->getCountry()][$state])) {
            $regionCode = $map[$address->getCountry()][$state];

            $set    = $this->regionFactory->create()->getCollection();
            $region = $set->addRegionCodeFilter($regionCode)->addCountryFilter($address->getCountry())->getFirstItem();
        }

        if (!$region->getId()) {
            $this->logger->error('Region not found, state provided: ' . $state . ' country: ' . $address->getCountry());
        }

        return $region;
    }
794475
public function get(int $address = null): int {
        
        if ($address == null) {
            $temp = $this->value++;
            $this->memory[$this->lenght] = $temp;
            $this->lenght++;
            return $temp;
        } else {
            if ($address > -1) {
               return $this->memory[$address];
           }
        }
    }
256515
public function getBalance(string $address = null):JsonResponse
    {
        $params = [];

        if (!is_null($address)) $params['address'] = $address;

        return $this->rpcPost('getBalance', $params);
    }
565116
public function trimAddress($address)
    {
        $address = trim($address);

        return (($address[0] == '<') && (substr($address, -1) == '>'))
            ? substr($address, 1, -1)
            : $address;
    }
1222343
protected function _splitAddresses($address)
    {
        if (!empty($this->limit) && count($this->addresses) == $this->limit) {
            return '';
        }

        if ($this->_isGroup($address) && !isset($this->error)) {
            $split_char = ';';
            $is_group   = true;
        } elseif (!isset($this->error)) {
            $split_char = ',';
            $is_group   = false;
        } elseif (isset($this->error)) {
            return false;
        }

        // Split the string based on the above ten or so lines.
        $parts  = explode($split_char, $address);
        $string = $this->_splitCheck($parts, $split_char);

        // If a group...
        if ($is_group) {
            // If $string does not contain a colon outside of
            // brackets/quotes etc then something's fubar.

            // First check there's a colon at all:
            if (strpos($string, ':') === false) {
                $this->error = 'Invalid address: ' . $string;
                return false;
            }

            // Now check it's outside of brackets/quotes:
            if (!$this->_splitCheck(explode(':', $string), ':')) {
                return false;
            }

            // We must have a group at this point, so increase the counter:
            $this->num_groups++;
        }

        // $string now contains the first full address/group.
        // Add to the addresses array.
        $this->addresses[] = array(
                                   'address' => trim($string),
                                   'group'   => $is_group
                                   );

        // Remove the now stored address from the initial line, the +1
        // is to account for the explode character.
        $address = trim(substr($address, strlen($string) + 1));

        // If the next char is a comma and this was a group, then
        // there are more addresses, otherwise, if there are any more
        // chars, then there is another address.
        if ($is_group && substr($address, 0, 1) == ','){
            $address = trim(substr($address, 1));
            return $address;

        } elseif (strlen($address) > 0) {
            return $address;

        } else {
            return '';
        }

        // If you got here then something's off
        return false;
    }
24686
private function scanAddress($address)
    {
        /*
         * today's timestamp used as report time (today 00:00) to prevent a lot of duplicates on the
         * same day. Using the same time will aggregate and deduplicate events into 1 per day.
         */


        if (!filter_var($address, FILTER_VALIDATE_IP) === false) {
            $addressReverse = implode('.', array_reverse(preg_split('/\./', $address)));

            foreach ($this->feeds as $feedName => $feedData) {
                $this->feedName = $feedName;

                if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                    $lookup = $addressReverse . '.' . $feedData['zone'] . '.';

                    if ($result = gethostbyname($lookup)) {
                        if ($result != $lookup) {
                            // If config is empty, we fall back to this
                            $reason = 'SPAM Sending host';

                            // Set the config default reason if available
                            if (array_key_exists('default', $feedData['codes'])) {
                                $reason = $feedData['codes']['default'];
                            }

                            // Set the config specific reason if available
                            if (array_key_exists($result, $feedData['codes'])) {
                                $reason = $feedData['codes'][$result];
                            }

                            $incident = new Incident();
                            $incident->source      = $feedName;
                            $incident->source_id   = false;
                            $incident->ip          = $address;
                            $incident->domain      = false;
                            $incident->class       = $feedData['class'];
                            $incident->type        = $feedData['type'];

                            /*
                             * today's timestamp used as report time (today 00:00) to prevent a lot of duplicates on the
                             * same day. Using the same time will aggregate and deduplicate events into 1 per day.
                             */
                            $incident->timestamp   = Carbon::today()->timestamp;

                            $incident->information = json_encode(
                                array_merge(
                                    $feedData['information'],
                                    [
                                        'reason' => $reason
                                    ]
                                )
                            );

                            $this->incidents[] = $incident;
                        }
                    }
                }
            }
        } else {
            $this->warningCount++;
        }

        return true;
    }
249448
public function checkAddress($address)
    {
        $addr = $this->decodeBase58($address);
        if (strlen($addr) != 50) {
            return false;
        }
        $check = substr($addr, 0, strlen($addr) - 8);
        $check = pack('H*', $check);
        $check = strtoupper(hash('sha256', hash('sha256', $check, true)));
        $check = substr($check, 0, 8);

        return $check == substr($addr, strlen($addr) - 8);
    }
62143
public function getEntry(Address $address)
    {
        $events = array_filter($this->events, function (Entry $entry) use ($address) {
            return $entry->getAddress()->isMatch($address);
        });
        $last_matching_entry = null;
        foreach ($events as $entry) {
            if ($entry->getAddress()->isEntireCache() || $entry->getAddress()->isEntireBin()) {
                $last_matching_entry = null;
            } elseif (!is_null($entry->expiration) && $entry->expiration < $_SERVER['REQUEST_TIME']) {
                $last_matching_entry = null;
            } else {
                $last_matching_entry = clone $entry;
            }
        }
        // Last event was a deletion, so miss.
        if (is_null($last_matching_entry) || is_null($last_matching_entry->value)) {
            $this->misses++;
            return null;
        }

        $unserialized_value = @unserialize($last_matching_entry->value);

        // If unserialization failed, miss.
        if (false === $unserialized_value && serialize(false) !== $last_matching_entry->value) {
            throw new UnserializationException($address, $last_matching_entry->value);
        }

        $last_matching_entry->value = $unserialized_value;

        $this->hits++;
        return $last_matching_entry;
    }
121363
public function getEntry(Address $address)
    {
        try {
            $sth = $this->dbh->prepare('SELECT "event_id", "pool", "address", "value", "created", "expiration" FROM ' . $this->prefixTable('lcache_events') .' WHERE "address" = :address AND ("expiration" >= :now OR "expiration" IS NULL) ORDER BY "event_id" DESC LIMIT 1');
            $sth->bindValue(':address', $address->serialize(), \PDO::PARAM_STR);
            $sth->bindValue(':now', $_SERVER['REQUEST_TIME'], \PDO::PARAM_INT);
            $sth->execute();
        } catch (\PDOException $e) {
            $this->logSchemaIssueOrRethrow('Failed to search database for cache item', $e);
            return null;
        }
        //$last_matching_entry = $sth->fetchObject('LCacheEntry');
        $last_matching_entry = $sth->fetchObject();

        if (false === $last_matching_entry) {
            $this->misses++;
            return null;
        }

        // If last event was a deletion, miss.
        if (is_null($last_matching_entry->value)) {
            $this->misses++;
            return null;
        }

        $unserialized_value = @unserialize($last_matching_entry->value);

        // If unserialization failed, raise an exception.
        if (false === $unserialized_value && serialize(false) !== $last_matching_entry->value) {
            throw new UnserializationException($address, $last_matching_entry->value);
        }

        $last_matching_entry->value = $unserialized_value;
        $this->hits++;
        return $last_matching_entry;
    }
665753
public function actionIndex($address = 'localhost')
    {
        $documentRoot = $this->app->getAlias($this->docroot);

        if (strpos($address, ':') === false) {
            $address = $address . ':' . $this->port;
        }

        if (!is_dir($documentRoot)) {
            $this->stdout("Document root \"$documentRoot\" does not exist.\n", Console::FG_RED);
            return self::EXIT_CODE_NO_DOCUMENT_ROOT;
        }

        if ($this->isAddressTaken($address)) {
            $this->stdout("http://$address is taken by another process.\n", Console::FG_RED);
            return self::EXIT_CODE_ADDRESS_TAKEN_BY_ANOTHER_PROCESS;
        }

        if ($this->router !== null && !file_exists($this->router)) {
            $this->stdout("Routing file \"$this->router\" does not exist.\n", Console::FG_RED);
            return self::EXIT_CODE_NO_ROUTING_FILE;
        }

        $this->stdout("Server started on http://{$address}/\n");
        $this->stdout("Document root is \"{$documentRoot}\"\n");
        if ($this->router) {
            $this->stdout("Routing file is \"$this->router\"\n");
        }
        $this->stdout("Quit the server with CTRL-C or COMMAND-C.\n");

        passthru('"' . PHP_BINARY . '"' . " -S {$address} -t \"{$documentRoot}\" $this->router");
    }
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;
    }
1119239
public function addIp(string $address): CollectionInterface
    {
        $this->collection->addIp($address);

        $this->clearCache();

        return $this;
    }
190552
private function isAddressValid(string $address): bool
    {
        $position = \strrpos($address, ':');
        if ($position === false) {
            return ($address[0] ?? '') === "\0"; // udg socket address.
        }

        $ip = \trim(\substr($address, 0, $position), '[]');
        $port = (int) \substr($address, $position + 1);

        return \inet_pton($ip) !== false && $port > 0 && $port < 65536;
    }
398246
public function getZonesFromAddress(AddressInterface $address)
    {
        return $this
            ->zoneRepository
            ->getActiveZones()
            ->filter(function (ZoneInterface $zone) use ($address) {

                return $this
                    ->zoneMatcher
                    ->isAddressContainedInZone(
                        $address,
                        $zone
                    );
            });
    }