public function loadHtmlFile($filePath)
    {
        if (!is_string($filePath)) {
            throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
        }

        if (!preg_match("/^https?:\/\//i", $filePath) && !file_exists($filePath)) {
            throw new RuntimeException("File $filePath not found");
        }

        try {
            $html = file_get_contents($filePath);
        } catch (\Exception $e) {
            throw new RuntimeException("Could not load file $filePath");
        }

        if ($html === false) {
            throw new RuntimeException("Could not load file $filePath");
        }

        $this->loadHtml($html);

        return $this;
    }
public function loadHtmlFile($filePath)
    {
        if (!is_string($filePath)) {
            throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
        }

        if (!preg_match("/^https?:\/\//i", $filePath) && !file_exists($filePath)) {
            throw new RuntimeException("File $filePath not found");
        }

        try {
            $html = file_get_contents($filePath);
        } catch (\Exception $e) {
            throw new RuntimeException("Could not load file $filePath");
        }

        if ($html === false) {
            throw new RuntimeException("Could not load file $filePath");
        }

        $this->loadHtml($html);

        return $this;
    }
public function loadHtmlFile ( $ filePath ) { if ( ! is_string ( $ filePath ) ) { throw new InvalidArgumentException ( __METHOD__ . ' expects parameter 1 to be string.' ) ; } if ( ! preg_match ( "/^https?:\/\//i" , $ filePath ) && ! file_exists ( $ filePath ) ) { throw new RuntimeException ( "File $filePath not found" ) ; } try { $ html = file_get_contents ( $ filePath ) ; } catch ( \ Exception $ e ) { throw new RuntimeException ( "Could not load file $filePath" ) ; } if ( $ html === false ) { throw new RuntimeException ( "Could not load file $filePath" ) ; } $ this -> loadHtml ( $ html ) ; return $ this ; }
Load HTML from file

@param string $filePath

@return Document

@throws InvalidArgumentException
@throws RuntimeException
Load HTML from file