Extracts the port from a given $url

@param $url string The URL

@return integer the port number. If not specified or invalid, the default http port 80 is returned.
962611
public static function getPortFromURL($url)
	{
		$url = self::getDomainFromURL($url);
		$url = explode(':', $url);
		
		if(count($url) == 1)
		{
			return 80;
		}
		else
		{
			if(!is_numeric($url[1]))
				return 80;
			else
				return (integer) $url[1];
		}
	}
1135497
public static function call($url)
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 25);
        curl_setopt($ch, CURLOPT_TIMEOUT, 45);

        $result = curl_exec($ch);

        if (! $result) {
            throw new \Exception(sprintf('The endpoint "%s" is not returning anything.', $url));
        }

        return simplexml_load_string($result);
    }
427043
public function get($url)
    {

        curl_setopt($this->handle, CURLOPT_POST, 0); // Added to clear past values
        curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, 'GET'); // Added to clear past values

        return $this->execute($url);
    }
588058
protected function filterPort($port)
    {
        if (is_null($port) || (is_integer($port) && ($port >= 1 && $port <= 65535))) {
            return $port;
        }

        throw new InvalidArgumentException('Uri port must be null or an integer between 1 and 65535 (inclusive)');
    }
894718
public function fetchUrl($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        // HTTPS
        if (strpos($url, 'https://') !== false) {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        }

        $res = curl_exec($ch);
        curl_close($ch);

        return $res;
    }
927757
public static function getRequestClientIP($url='')
    {
        if (!$url || !is_string($url)){
            if (isset($_SERVER['REMOTE_ADDR']))
                $url = $_SERVER['REMOTE_ADDR'];
        }
        return (filter_var($url, FILTER_VALIDATE_IP)) ? $url : '';
    }
785419
static function quickGet($url)
    {
        $bits = parse_url($url);
        $host = $bits['host'];
        $port = isset($bits['port']) ? $bits['port'] : 80;
        $path = isset($bits['path']) ? $bits['path'] : '/';
        if (isset($bits['query']))
        {
            $path .= '?' . $bits['query'];
        }
        $client = new self($host, $port);
        if (!$client->get($path))
        {
            return false;
        }
        else
        {
            return $client->getContent();
        }
    }
1082149
public static function segmentUrl($url = null)
    {
        if (!is_null($url) && !empty($url)) {
            $url = $url;
        } else {
            $url = self::requestInstance()->getRequestUrl();
        }

        return explode('/', trim($url, '/'));
    }
1005973
public function url($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            return $this->set('CURLOPT_URL', $url)->process();
        }
        throw new Exception('Target URL is required.', 500);
    }
991018
protected function fetchUrl(string $url): string
    {
        $curl = curl_init($url);
        curl_setopt_array($curl, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => $this->timeOut
        ]);
        $data = curl_exec($curl);
        $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        $error = curl_error($curl);
        curl_close($curl);

        if ($error) {
            throw new FetchFailedException(sprintf("A cURL error occurred for \"%s\": %s", $url, $error));
        }

        if ($statusCode !== 200) {
            throw new FetchFailedException(sprintf("URL \"%s\" responded with status code %d.", $url, $statusCode));
        }

        if (!$data) {
            throw new FetchFailedException(sprintf("URL \"%s\" returned no data.", $url));
        }

        return $data;
    }
1110978
private function &getHandle($url) {
      $http = curl_init();

      curl_setopt($http, CURLOPT_USERAGENT, Client::getUserAgent());
      curl_setopt($http, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($http, CURLOPT_URL, $url);

      return $http;
    }
18181
public function httpStatusConnection($url)
    {
        if ( ! filter_var($url, FILTER_VALIDATE_URL)) {// check, if a valid url is provided
            return false;
        }

        $handle = curl_init($url);
        curl_setopt($handle,  CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);// 301 solved
        $response = curl_exec($handle);
        $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
        curl_close($handle);

        return $httpCode == 200 ? true : false;
    }
177486
protected function parseUrl($url) : string
    {
        // Ignore if its a valid url already, or an anchor link
        if (is_string($url) &&
            (filter_var($url, FILTER_VALIDATE_URL) !== false || Str::startsWith($url, '#'))) {
            return $url;
        }


        return $this->url->url($url);
    }
249389
function getPort(url) {
    // URL may contain the port number after the second colon.
    // http://domain:1234/
    var index = url.indexOf(":", 6); // skipping 6 characters to ignore first colon
    return index < 0 ? 80 : parseInt(url.substr(index + 1), 10);
  }
1248146
public function get($url)
    {
        $url = str_replace('__random__', rand(100000, 999999), $url);

        return $this->client->get($url, ['timeout' => 10])->getBody();
    }
548823
public static function url($url){

		$url = static::_nullValue($url);
		if(!$url){

			return $url;
		}

		$query = parse_url($url, PHP_URL_QUERY);
		if(!$query){

			return $url;
		}

		parse_str($query, $query_parts);

		// First urldecode to be sure that we do not re-encode the query parts.
		$query_parts = array_map('static::_nested_urldecode', $query_parts);

		// http_build_query will take care of the urlencode.
		return strtok($url, '?') . '?' . http_build_query($query_parts);
	}
30434
public function request($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

        $result = curl_exec($ch);
        curl_close($ch);

        return json_decode($result);
    }