Dom\HTMLDocument::createFromFile
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.4.0)
Parses an HTML document from a file
Description
Dom\HTMLDocument::createFromFile(string $path, int $options = 0, string|null $overrideEncoding = null): Dom\HTMLDocument
Parses an HTML document from a file, according to the living standard.
Parameters
pathThe path to the file to parse.
optionsOptions
overrideEncodingEncoding
Return Values
The parsed document as an Dom\HTMLDocument instance.
Errors/Exceptions
- Throws a
ValueErrorifpathcontains null bytes or contains"%00". - Throws an
Exceptionif the file could not be opened.
Whitespace
See Also
Dom\HTMLDocument::createEmptyDom\HTMLDocument::createFromString