Issues a request to $url eg. "?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1"

@param string $url
@return string
355260
private function request($url)
    {
        $url = $this->makeRequestUrl($url);

        try {
            $cliMulti  = $this->makeCliMulti();
            $responses = $cliMulti->request(array($url));

            $response  = !empty($responses) ? array_shift($responses) : null;
        } catch (Exception $e) {
            return $this->logNetworkError($url, $e->getMessage());
        }
        if ($this->checkResponse($response, $url)) {
            return $response;
        }
        return false;
    }
848710
public static function getHostFromUrl($url)
    {
        $parsedUrl = parse_url($url);

        if (empty($parsedUrl['host'])) {
            return;
        }

        return Common::mb_strtolower($parsedUrl['host']);
    }
144828
private function curl_request($url = '')
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 0);
        $output = curl_exec($ch);
        curl_close($ch);
        return $output;
    }
790140
public static function getFromUrl($url)
    {
        // check is valid url
        if (!filter_var($url, FILTER_VALIDATE_URL) || !function_exists('curl_init')) {
            return null;
        }

        // initialize curl & set required options and target url
        $curl = \curl_init();
        \curl_setopt($curl, CURLOPT_URL, $url);
        if (Str::startsWith('https', $url)) {
            \curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
            \curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        }
        \curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        \curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        \curl_setopt($curl, CURLOPT_HEADER, 0);
        \curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
        \curl_setopt($curl, CURLOPT_FAILONERROR, true);
        \curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        \curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        \curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        $content = \curl_exec($curl);
        \curl_close($curl);

        return $content;
    }
1132487
protected function _fixUrlForParsing($url)
    {
        $path = $url->path;

        //bug in request
        if ($url->format == 'php') {
            $path .= '.php';
            $url->format = null;
        }

        $path = substr_replace($path, '', 0, strlen($this->_base_url->path));
        $path = preg_replace('/index\/?.php/', '', $path);
        $path = trim($path, '/');

        $url->path = $path;
        $url->format = $url->format ? $url->format : pick(AnRequest::format(), 'html');

        if (! empty($url->format)) {
            $url->query['format'] = $url->format;
        }
    }
286853
public static function getUrlWithProtocol($url) {
		if(empty($url)) {
			return $url;
		}
		list($scheme, $host) = self::splitUrl($url);
		if(empty($scheme) || empty($host)) {
			return '';
		}
		return $scheme.'://'.$host;
	}
1128858
protected function extract(string $url):string {
		$this->initCurl();

		curl_setopt_array($this->curl, [
			CURLOPT_FOLLOWLOCATION => false
		]);

		$response = $this->getResponse($url);

		if(!$response instanceof ResponseInterface){
			return ''; // @codeCoverageIgnore
		}

		$info    = $response->info;
		$headers = $response->headers;

		// check curl_info()
		if(in_array($info->http_code, range(300, 308), true) && isset($info->redirect_url) && !empty($info->redirect_url)){
			return $info->redirect_url;
		}
		// look for a location header
		elseif(isset($headers->location) && !empty($headers->location)){
			return $headers->location; // @codeCoverageIgnore
		}

		return '';
	}
895995
protected function curl($url) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,            $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER,         false);
        curl_setopt($ch, CURLOPT_HTTP_VERSION,   CURL_HTTP_VERSION_1_1);
        curl_setopt($ch, CURLOPT_HTTPHEADER,     array('Content-Type: text/plain'));
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 2000);
        curl_setopt($ch, CURLOPT_TIMEOUT_MS, 2000);

        return curl_exec($ch);
    }
1210187
public function getLocaleByUrl($url)
    {
        foreach ($this->getLocales() as $locale) {
            if ($locale->getUrl() === $url) {
                return $locale;
            }
        }
    }
743236
public static function resolveHttp($url = null)
    {
        if (is_null($url)) {
            return '';
        }
        $url = preg_replace(',^feed://,i', 'http://', $url);
        if (!preg_match(',^[a-z]+://,i', $url)) {
            $url = 'http://'.$url;
        }
        return $url;
    }
273147
public static function normalize($url)
    {
        $u = parse_url(preg_replace('#^file:/+([a-z]+:)#i', '$1', $url));

        if ($u === false) {
            return $url;
        }

        if (empty($u['scheme'])) {
            $u = null;
            return false;
        }

        $scheme = strtolower($u['scheme']);

        if (strlen($scheme) > 1) {
            $normalized = $scheme . '://';
        } else {
            $normalized = strtoupper($scheme) . ':';
        }

        if (isset($u['user'])) {
            $normalized .= $u['user'];
            $normalized .= isset($u['pass']) ? (':' . $u['pass']) : '';
            $normalized .= '@';
        }

        if (isset($u['host'])) {
            if (in_array($scheme, static::$defaultSchemes)) {
                $host = urldecode($u['host']);
                $normalized .= mb_strtolower($host, mb_detect_encoding($host));
            } else {
                $normalized .= $u['host'];
            }
        }

        if (isset($u['port']) && !in_array($scheme . ':' . $u['port'], static::$defaultPorts)) {
            $normalized .= ':' . $u['port'];
        }

        if (empty($u['path']) || $u['path'] === '/') {
            $normalized .= '/';
        } else {
            $normalized .= '/' . ltrim(self::canonpath($u['path']), '/');
        }

        if (isset($u['query'])) {
            $normalized .= self::canonquery($u['query'], '?');
        }

        if (isset($u['fragment'])) {
            $normalized .= '#' . $u['fragment'];
        }

        $u = null;
        return $normalized;
    }
354227
public function normalizeUrl($url)
    {
        $url = trim($url, '/') .'/';

        // if the page is the index page then hide it from the menu
        if (strpos(strtolower($url), '/index.md/')) {
            $url = substr($url, 0, strpos($url, "index.md/"));
        }

        return $url;
    }
1099712
public function urlQuerystring($url)
    {
        $querystring = $this->querystring();
        if (isset($this->timestamp) && !Utils::contains($querystring, $this->timestamp)) {
            $querystring = empty($querystring) ? ('?' . $this->timestamp) : ($querystring . '&' . $this->timestamp);
        }

        return ltrim($url . $querystring . $this->urlHash(), '/');
    }
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];
		}
	}
1131335
public function localePrefix($url)
    {
        if (option('url_locale_prefix') &&
            str_starts_with($url, '/') &&
            !preg_match('/^\/' . $this->_localesPattern() . '/', $url)
        ) {
            $url = '/' . I18n::locale() . $url;
        }

        return $url;
    }
354041
final static function normalize(string $url):string{#{{{

    if(isset(
      $_SERVER['REQUEST_SCHEME'],
      $_SERVER['REQUEST_HOST'],
      $_SERVER['REQUEST_PORT'],
      $_SERVER['REQUEST_URI'],
      $_SERVER['SERVER_PORT']
    ) || PHP_SAPI ==='cli')
      return $url;

    $arr = parse_url($url);
    if($arr===false) return '';

    $a = [
      $arr['scheme']??$_SERVER['REQUEST_SCHEME'],
      '://',
      $arr['user']??'',
      ':',
      $arr['pass']??'',
      '@',
      $arr['host']??$_SERVER['HTTP_HOST'],
      ':',
      $arr['port']??$_SERVER['SERVER_PORT'],
      substr($_SERVER['REQUEST_URI'],0, strrpos($_SERVER['REQUEST_URI'],'/')+1),
      $arr['path']??'',
      '?',
      $arr['query']??'',
      '#',
      $arr['fragment']??'',
    ];

    if(!in_array($a[0], ['http','https'])) return '';

    if($a[12]==='')            unset($a[11],$a[12]);
    if($a[14]==='')            unset($a[13],$a[14]);
    if($a[8]==80)              unset($a[7],$a[8]);
    if($a[4]==='')             unset($a[3],$a[4]);
    if($a[2]==='')             unset($a[2],$a[3],$a[4],$a[5]);
    if(strpos($a[10],'/')===0) unset($a[9]);

    while(strpos($a[10],'../')===0){
      $a[10] = substr($a[10],3);
      $a[9] = dirname($a[9]);
      if($a[9]!=='/') $a[9] .= '/';
    }

    while(strpos($a[10],'./')===0){
      $a[10] = substr($a[10],2);
    }

    if($a[10]==='.') unset($a[10]);

    return implode($a);
  }
1127440
public static function getPathFromURL($url)
	{
		$path = str_replace(self::getProtocolFromURL($url) . '://', '', $url);
		$path = str_replace(self::getDomainFromURL($url), '', $path);
		
		if($path == '') return '/';
		
		return $path;
	}