@param $url

@throws Exception

@return mixed
547640
public function short($url)
    {
        $this->clear();
        $this->addUrl($url);
        $req = $this->out();

        if ('json' == $this->getFormat() || 'array' == $this->getFormat()) {
            return $req;
        }

        $return = $this->response;
        $this->clear();

        return $return;
    }
596978
public function checkUrl($url) {
    try {
      $client = new Client();
      $res = $client->request('GET', $url, [
        'connection_timeout' => 2,
        'timeout' => 2,
        'exceptions' => FALSE,
      ]);
      if ($res->getStatusCode() && substr($res->getStatusCode(), 0, 1) != '5') {
        return TRUE;
      }
      else {
        $this->logger->debug($res->getBody());
        return FALSE;
      }
    }
    catch (\Exception $e) {
      $this->logger->debug($e->getMessage());
    }
    return FALSE;
  }
1273399
public function get( $url ) {
		$this->assertString( 'url', $url );

		if ( !isset( $this->conn ) ) {
			$this->connect();
		}

		$this->setCurlGetOpts( $url );

		return $this->request();
	}
199724
static public function httpGet($url)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_SSLVERSION, 1);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        list($content, $status) = array(curl_exec($curl), curl_getinfo($curl), curl_close($curl));
        return (intval($status["http_code"]) === 200) ? $content : false;
    }
151701
public static function parse($url)
    {
        $scheme = substr($url, 0, strpos($url, ':'));
        if (strpos($scheme, '+')) {
            $scheme = substr($scheme, 0, strpos($scheme, '+'));
        }

        if (!$scheme) {
            throw new \Exception(sprintf('The url \'%s\' could not be parsed', $url));
        }

        if (isset(static::$schemeMap[$scheme])) {
            $className = static::$schemeMap[$scheme];
        } else {
            $className  = static::currentNamespace() . '\\' . ucfirst($scheme) . 'Dsn';
            if (!class_exists($className)) {
                $className  = static::currentClass();
            }
        }
        return new $className($url);
    }
854241
public function url($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
            return $url;
        }

        if (is_string($url)) {
            return $this->parseStringUrl($url);
        }

        if (is_array($url)) {
            return $this->make(new UrlSettings($url));
        }

        if ($url instanceof UrlSettings) {
            return $this->make($url);
        }

        throw new \InvalidArgumentException('Settings is not a supported type');
    }
994965
protected function fetchEndpointForUrl($url)
    {
        $endPoint = null;

        try {
            $content = $this->browser->getContent($url);
        } catch (Exception $exception) {
            throw new Exception(
                'Unable to fetch the page body for "' . $url . '": ' . $exception->getMessage(),
                Exception::PAGE_BODY_FETCH_FAILED
            );
        }

        preg_match_all("/<link rel=\"alternate\"[^>]+>/i",
            $content,
            $out);
        if ($out[0]) {
            foreach ($out[0] as $link) {
                if (strpos($link, trim($this->preferredFormat . '+oembed')) !== false) {
                    $endPoint = $this->extractEndpointFromAttributes($link);
                    break;
                }
            }
        } else {
            throw new Exception(
                'No valid oEmbed links found on the document at "' . $url . '".',
                Exception::NO_OEMBED_LINKS_FOUND
            );
        }

        return $endPoint;
    }
854864
protected function getValueFromUrl($url)
    {
        $type = substr($url, 0, strpos($url, Ldif::KEY_VALUE_SEPARATOR));

        if (!$this->hasUrlLoader($type)) {
            $this->throwException(sprintf('Cannot find a URL loader for type "%s"', $type));
        }

        try {
            return $this->urlLoaders[$type]->load($url);
        } catch (LdifUrlLoaderException $e) {
            $this->throwException($e->getMessage());
        }
    }
1138060
private function getRequest($url)
    {
        if ($this->baseUri && substr($url, 0, 1) != '/') {
            throw new \InvalidArgumentException(
                sprintf("Invalid uri '%s' with baseUri '%s'", $url, $this->baseUri->get(false))
            );
        }

        if ($this->baseUri && $url) {
            $uri = clone $this->baseUri;
            $uri->setPath($uri->getPath() . $url);
        } else {
            $uri = $url instanceof Uri ? $url : new Uri($url);
        }

        return new Request($uri);
    }
1316773
private function _get($url)
    {
        curl_setopt($this->_curlHandle, CURLOPT_HTTPGET, true);
        curl_setopt($this->_curlHandle, CURLOPT_CUSTOMREQUEST, 'GET');
        return $this->_curlHelper($url);
    }
86211
protected static function parseUrl($url)
    {
        $components = @parse_url($url);
        if (! empty($components)) {
            return $components;
        }

        if (is_null(static::$is_parse_url_bugged)) {
            static::$is_parse_url_bugged = ! is_array(@parse_url("//example.org:80"));
        }

        //bugfix for https://bugs.php.net/bug.php?id=68917
        if (static::$is_parse_url_bugged &&
            strpos($url, '/') === 0 &&
            is_array($components = @parse_url('http:'.$url))
        ) {
            unset($components['scheme']);
            return $components;
        }
        throw new RuntimeException(sprintf("The given URL: `%s` could not be parse", $url));
    }
90346
private static function parse($url)
    {
        $enc_url = preg_replace_callback(
            '%[^:/@?&=#]+%usD',
            function ($matches) {
                return rawurlencode($matches[0]);
            },
            $url
        );

        $parts = parse_url($enc_url);

        if ($parts === false) {
            throw new \InvalidArgumentException('Malformed URL: ' . $url);
        }

        if (!empty($parts['scheme']) && !in_array($parts['scheme'], ['http', 'https', 'data'])) {
            throw new \InvalidArgumentException(sprintf('Invalid URL scheme: "%s"', $parts['scheme']));
        }

        foreach ($parts as $name => $value) {
            $parts[$name] = rawurldecode($value);
        }
        return $parts;
    }
93065
public static function getClassNameByUrl($url){
        $class = null;
        if(!empty($url)){
            try{
                $route = new Resolver(new common_http_Request($url));
                $route->setServiceLocator(ServiceManager::getServiceManager());
                $class = $route->getControllerClass();
            } catch(\ResolverException $re){
                throw new common_exception_Error('The url "'.$url.'" could not be mapped to a controller : ' . $re->getMessage());
            }
        }
        if (is_null($class)) {
            throw new common_exception_Error('The url "'.$url.'" could not be mapped to a controller');
        }
        return $class;
    }
890474
public static function get(string $url)
	{
		$ch = curl_init($url);

		curl_setopt_array(
			$ch,
			[
				CURLOPT_HEADER         => 1,
				CURLOPT_RETURNTRANSFER => 1,
				CURLOPT_SSL_VERIFYPEER => 0,
			]
		);

		$response = curl_exec($ch);

		$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		if ($responseCode != 200) {
			throw new HttpException('Could not reach ' . $url, $responseCode);
		}
		$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
		$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

		curl_close($ch);

		$response = substr($response, $headerSize);

		if (is_null($response)) {
			throw new HttpException('You are exceeding the API request limit.  Please wait longer between requests.', 400);
		}

		if(stripos($contentType, 'application/json') !== false) {
			$response = json_decode($response, true);
		}

		return $response;
	}
1085159
public function verify($url)
    {
        $url = parse_url($url);
        if ($url === false) {
            throw new \Exception('Bad url to match (not an url ?)');
        }

        $path = isset($url['path']) ? $url['path'] : '';

        if ((bool) preg_match($this->pattern, $path, $matches)) {
            array_shift($matches);

            foreach ($matches as $position => $value) {
                $this->parameterCollection->getByPosition($position)
                    ->setValue($value);
            }

            return true;
        }

        return false;
    }
540478
protected function getUrlContents(string $url): string
    {
        $request = $this->getRequest($url);

        return $this->getParsedResponse($request);
    }
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;
    }