Inits HtmlDomParser with HTML content by URL.

@param string $url URL of the page.
@param boolean $curl Use CURL to load content or file_get_contents($url)
method.

@throws Exception If content loading error occurred.
15787
public function loadUrl($url, $curl = false) {
        if ($curl) {
            $content = self::loadContent($url);
            if (empty($content)) {
                throw new Exception("Can't get content from " . $url);
            }
            $this->loadString($content);
        } else {
            $this->load_file($url);
        }
    }
1263207
protected function initialize($url)
    {
        $url = filter_var($url, FILTER_SANITIZE_URL);
        $parsedUrl = parse_url($url);

        if (false === filter_var($url, FILTER_VALIDATE_URL) || false === $parsedUrl) {
            throw new InvalidArgumentException(sprintf('URL "%s" seriously malformed.', $url));
        }

        $parsedUrl = $parsedUrl + [
                'scheme' => '',
                'host' => '',
                'port' => null,
                'user' => '',
                'pass' => '',
                'path' => '',
                'fragment' => '',
                'query' => ''
            ];

        $this->scheme = $this->filterScheme($parsedUrl['scheme']);
        $this->host = $this->filterHost($parsedUrl['host']);
        $this->port = $this->filterPort($parsedUrl['port']);
        $this->path = $this->filterPath($parsedUrl['path']);
        $this->query = $this->filterQuery($parsedUrl['query']);
        $this->fragment = $this->filterFragment($parsedUrl['fragment']);

        if ($parsedUrl['user']) {
            if ($parsedUrl['pass']) {
                $this->userInfo = $parsedUrl['user'] . ':' . $parsedUrl['pass'];
            } else {
                $this->userInfo = $parsedUrl['user'];
            }
        }
    }
801986
public function loadFromUrl(string $url, array $options = [], CurlInterface $curl = null): Dom
    {
        if (is_null($curl)) {
            // use the default curl interface
            $curl = new Curl;
        }
        $content = $curl->get($url);

        return $this->loadStr($content, $options);
    }
522936
public static function curlInit($url = null)
    {
        $curlHandle = \curl_init($url);
        self::$requests[(int) $curlHandle] = new Request('GET', $url);
        self::$curlOptions[(int) $curlHandle] = array();

        return $curlHandle;
    }
3828
protected function _getCURL($url) {
		curl_setopt($this->_curl, CURLOPT_URL, $url);
		$content = curl_exec($this->_curl);
		return $content;
	}
217368
public function open($url = null)
    {
        $this->handle = curl_init($url);

        return $this->handle !== false;
    }
1183767
public function send($url, $curled = true)
    {
        $this->setUrl($url);

        $result = ($this->isCurlExists() && $curled === true)
            ? $this->curl()
            : file_get_contents($this->url);

        return $this->checkResult($result) ? $result : '{}';
    }
204140
protected function openUrl($url)
    {
        $browser = $this->getDefaultBrowser();
        if ($browser) {
            $opened = $this->getHelper('process')->run($this->stdOut, array($browser, $url));
            if ($opened) {
                $this->stdErr->writeln("<info>Opened</info>: $url");
                return;
            }
        } else {
            $this->stdErr->writeln("<error>Browser not found: $browser</error>");
        }
        $this->stdOut->writeln($url);
    }
600402
protected function request($url, $curlOptions = array()) {
        // create curl instance
        $curl = curl_init($url);
        $curlOptions['url'] = $url;
        $this->resetCurlOptions();
        $this->prepareRequest($curl, $curlOptions);
        if ($this->cacheInstance && $httpbody = $this->cacheInstance->get($this->curlOptions)) {
            return $httpbody;
        } else {
            $httpbody = curl_exec($curl);
            if ($this->cacheInstance) {
                $this->cacheInstance->set($this->curlOptions, $httpbody);
            }
        }

        $this->info  = curl_getinfo($curl);
        $this->error = curl_error($curl);

        if ($this->debug){
            var_dump($this->info);
            var_dump($this->error);
        }

        curl_close($curl);

        $response = new CurlHttpResponse($this->info['http_code'], $this->responseHeaders, $httpbody);

        if (!empty($this->error)) {
            throw new \Exception($this->error);
        }
        return $response;
    }
106938
public function setPharUrl($url)
    {
        if (!$this->validateAllowedUrl($url)) {
            throw new InvalidArgumentException(
                sprintf('Invalid url passed as argument: %s.', $url)
            );
        }
        $this->pharUrl = $url;
    }
1304637
public function loadFromUrlByProxy($url, $options = [], CurlInterface $curl = null, $proxy = null)
    {
        //$proxy = "120.195.203.43:80";
        //$proxy = explode(':', $proxy);

        if (is_null($curl))
        {
            // use the default curl interface
            $curl = new CurlProxy;
        }
        $content = $curl->get($url, $proxy);

        return $this->loadStr($content, $options);
    }
1347313
public function file_get_contents_curl($url)
    {
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
        curl_setopt($ch, CURLOPT_URL, $url);

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

        return $data;
    }
1293607
public void init(BaseApplet applet, URL url)
    {
    	m_applet = applet;
    	
        this.setContentType(HTML_CONTENT);
        this.setEditable(false);
        this.addHyperlinkListener(this.createHyperLinkListener());
        this.setOpaque(false);
        this.setSize(new Dimension(500, 800));
        
        if (url != null) 
            this.linkActivated(url, applet, 0);
    }
757888
private function checkUrl($url): void
    {
        if (!\is_string($url)) {
            $type = \gettype($url);
            throw new PingableException("Url must be of type string, '{$type}' given.");
        }

        if ('' === $url) {
            throw new PingableException('Url cannot be empty.');
        }
    }
478994
public function setUrl($url)
    {
        $this->reset();

        foreach (parse_url($url) as $part => $value) {
            $this[$part] = $value;
        }
    }
658743
function ParseUrl($url) {
	    $content = null;

    	$this->Clear();

		$this->url = htmlspecialchars_decode($url);

	    ob_start();
	    if (function_exists('curl_init')) {
		    //curl is the preferred function
		    $crl = curl_init();
		    curl_setopt($crl, CURLOPT_URL, $url);
		    curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
		    curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, 5);
		    curl_setopt($crl, CURLOPT_TIMEOUT, 20);
		    $FileData = curl_exec($crl);
		    $FileInfo = curl_getinfo($crl);
		    curl_close($crl);
		    if ($FileInfo['http_code'] != 200) {
			    throw new \HttpRequestException($FileInfo['http_code'] . ' error for file: ' . $url);
		    }
	    } else {
		    //see if we can use fopen to get file
		    $fopen_check = ini_get('allow_url_fopen');
		    if (!empty($fopen_check)) {
			    $content = file_get_contents($url);
		    } else {
			    throw new \RuntimeException('CURL_DISABLED');
		    }
	    }
	    ob_end_clean();

		if(strlen($content)) {
			$this->modifyContent($content);
			$this->ParseStr($content);
			return true;
		} else {
			return false;
		}
	}
437921
public function loadString($content, $url = null)
    {
        parent::loadString($content);

        //Let twig load the content by proxiing through the getSource() method.
        $this->_twig_template = $this->_twig->loadTemplate($content);

        //Push the template on the stack
        array_push($this->_stack, $url);
        return $this;
    }