Check the connection status
@param $url
@return bool
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;
    }
32774
public function info($url)
    {
        $url = 'http://' . $this->ip . '/' . ltrim($url, '/');
        $options = [
            CURLOPT_URL            => $url,
            CURLOPT_PORT           => $this->port,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_VERBOSE        => WS::config()->get('debug', false)
        ];

        $ch = curl_init();
        curl_setopt_array($ch, $options);
        $response = curl_exec($ch);

        return $this->formatResponse($response);
    }
600032
protected function checkConnection()
    {
        // If the connection could not be established, fsockopen sadly does not
        // only return false (as documented), but also always issues a warning.
        if ( ( $this->connection === null ) &&
             ( ( $this->connection = @fsockopen( $this->options['ip'], $this->options['port'], $errno, $errstr ) ) === false ) )
        {
            // This is a bit hackisch...
            $this->connection = null;
            throw new phpillowConnectionException(
                "Could not connect to server at %ip:%port: '%errno: %error'",
                array(
                    'ip'    => $this->options['ip'],
                    'port'  => $this->options['port'],
                    'error' => $errstr,
                    'errno' => $errno,
                )
            );
        }
    }
298226
public function checkLink($url)
    {
        $url = trim($url);
        if (substr($url, 0, 7 ) == "http://") return $url;

        if (substr($url, 0, 8 ) == "https://") return $url;

        return "http://".$url;
    }
886706
public function verify($url = null) {
    if($url === null) {
      $url = $_SERVER['REQUEST_URI'];
    }

    $part = parse_url($url);

    if(isset($part['query'])) {
      parse_str($part['query'], $query);
    }

    if(!isset($query[$this->getParam])) {
      return false;
    }

    $request = $this->getRequest($url);
    if($this->gettoken($request) === $query[$this->getParam]) {
      return true;
    }
    return false;
  }
328119
public function isAccessible($url)
    {
        $context = $this->getContext($url);

        return is_resource(@fopen($url, 'r', null, $context));
    }
540491
public function getStatus(string $url) {
        // Setup connection
        $resource = curl_init($url);

        // Setup cURL options
        curl_setopt($resource, CURLOPT_NOBODY, true);
        curl_setopt($resource, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($resource,CURLOPT_HEADER,true);
        curl_setopt($resource,CURLOPT_RETURNTRANSFER,true);
        curl_setopt($resource, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($resource, CURLOPT_MAXREDIRS, 10);
        curl_setopt($resource,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; rv:65.0) Gecko/20100101 Firefox/65.0');
        curl_setopt($resource, CURLOPT_HTTPGET, true);
        curl_setopt($resource, CURLOPT_CUSTOMREQUEST, 'GET');
        curl_setopt($resource, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, 0);


        // Execute cURL
        curl_exec($resource);

        // Get the HTTP status code
        $httpCode = curl_getinfo($resource, CURLINFO_HTTP_CODE);

        // Close the connection
        curl_close($resource);

        // Return the status
        return $httpCode;
    }
323526
public function isServerWebsocket(int $fd): bool
    {
        return (bool) $this->server->connection_info($fd)['websocket_status'] ?? false;
    }
667776
private function http_get($url){
        $oCurl = curl_init();
        if(stripos($url,"https://")!==FALSE){
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
        }
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
        $sContent = curl_exec($oCurl);
        $aStatus = curl_getinfo($oCurl);
        curl_close($oCurl);
        if(intval($aStatus["http_code"])==200){
            return $sContent;
        }else{
            return false;
        }
    }
1345317
public function isLinkDead( $url ) {
		$deadVal = $this->areLinksDead( [ $url ] );
		$deadVal = $deadVal[$url];

		return $deadVal;
	}
1004917
public function check_connection()
    {
        // Establish connection if it wasn't done yet
        if (!$this->connect_done && !empty($this->options['user'])) {
            return $this->connect(
                $this->options['host'],
                $this->options['user'],
                $this->options['password'],
                $this->options['port'],
                $this->options['ssl']
            );
        }

        return $this->is_connected();
    }
1263443
private function matchUrl($url)
    {
        $request = Request::create($url);
        $this->requestAnalyzer->analyze($request);

        try {
            return null !== $this->router->matchRequest($request);
        } catch (ResourceNotFoundException $exception) {
            return false;
        }
    }
816078
public static function active( $url )
	{
		$url = parse_url( $url, PHP_URL_PATH );

		if ( empty( $url ) )
		{
			return false;
		}

		if ( $url[0] !== '/' )
		{
			$url = static::to( $url );
		}

		// when we are on "/" only "/" counts as active.
	 	if ( $url === '/' )
		{
			return static::current() == $url;
		}

		// for everything else we cut the url and compare
		$cut = substr( static::current(), 0, strlen( $url ) );

		return $cut == $url;
	}
1199515
protected function isValidDomain($url)
    {
        $trusted = $this->config->trusted_sites;


        if (!empty($trusted)) {
            extract(parse_url($url));

            $host = substr($url, 0, strpos($url, $host)).$host;

            if (!$this->matchHost($host, $trusted)) {
                return false;
            }
        }
        return $url;
    }
1088690
public function isWebpage($url) {
		$url = filter_var($url, FILTER_VALIDATE_URL);
		if (!strlen($url)) {
			return false;
		}
		
		$c = curl_init(); 
		curl_setopt($c, CURLOPT_URL, $url); 
		curl_setopt($c, CURLOPT_HEADER, 1); // get the header 
		curl_setopt($c, CURLOPT_NOBODY, 1); // and *only* get the header 
		curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // get the response as a string from curl_exec(), rather than echoing it 
		curl_setopt($c, CURLOPT_FRESH_CONNECT, 1); // don't use a cached version of the url 
		$result = curl_exec($c);
		
		if (!$result) { 
			return false; 
		} 
		
		if (stripos($result, 'Content-type: text/html')) {
//			$svc = new RestfulService($url);
//			$response = $svc->request('', 'GET');
			return true;
		}
		
		return false;
	}
852437
public function checkConnection() {
        try {
            $st = $this->_conn->query("SELECT 1");
        } catch(\PDOException $pe) {
            if ((strcasecmp($pe->getCode(), 'HY000') !== 0) && !stristr($pe->getMessage(), 'server has gone away'))
                throw $pe;

            if (function_exists('xdebug_start_trace'))
                xdebug_start_trace();

            $this->_resetConnection();
            $this->_connect();
        }

        return true;
    }
329334
public function supports($url)
    {
        $error = $this->validator->validate($url, [new Url()]);

        return 0 === count($error);
    }