### Serve MkDocs Project for Local Preview Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/README.md Commands to start a local development server for the MkDocs project. This allows you to preview the documentation site in a web browser, typically accessible at http://127.0.0.1:8000, before building the final output. ```Shell mkdocs serve ``` ```Shell python3 -m mkdocs serve ``` -------------------------------- ### Check and Install MkDocs Version Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/README.md Commands to check the installed version of MkDocs and to install or upgrade it using pip. A version of 1.0.4 or higher is recommended. These commands require Python and pip to be installed on the system. ```Shell mkdocs --version ``` ```Shell python3 -m mkdocs --version ``` ```Shell pip install mkdocs ``` ```Shell python3 -m pip install mkdocs ``` -------------------------------- ### Install or Upgrade MkDocs Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/README.md Commands to install or upgrade MkDocs using pip, in case the installed version is older than required or MkDocs is not yet installed. ```Shell pip install mkdocs ``` ```Shell python3 -m pip install mkdocs ``` -------------------------------- ### Extract Specific Elements from HTML Document using PHP Simple HTML DOM Parser Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/quick-start.md Loads an HTML document from a URL and demonstrates how to find and extract specific elements using CSS selectors. This example retrieves and prints the 'src' attribute of all image elements and the 'href' attribute of all anchor links. ```php $html = file_get_html('https://www.google.com/'); foreach($html->find('img') as $element) echo $element->src . '
'; foreach($html->find('a') as $element) echo $element->href . '
'; ``` -------------------------------- ### Collect Information from Slashdot (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/quick-start.md Provides an example of web scraping by loading the Slashdot homepage, using CSS selectors to identify article elements, and extracting specific details like title, intro, and details into a structured array for further processing. This highlights the ease of parsing HTML with CSS selectors and magic methods. ```php $html = file_get_html('https://slashdot.org/'); $articles = $html->find('article[data-fhtype="story"]'); foreach($articles as $article) { $item['title'] = $article->find('.story-title', 0)->plaintext; $item['intro'] = $article->find('.p', 0)->plaintext; $item['details'] = $article->find('.details', 0)->plaintext; $items[] = $item; } print_r($items); ``` -------------------------------- ### Collect Information from Slashdot using PHP Simple HTML DOM Parser Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/quick-start.md Demonstrates how to scrape structured information from a live website (Slashdot.org) by combining CSS selectors and magic methods. It extracts article titles, introductions, and details into an array for further processing, illustrating the parser's ease of use for data collection. ```php $html = file_get_html('https://slashdot.org/'); $articles = $html->find('article[data-fhtype="story"]'); foreach($articles as $article) { $item['title'] = $article->find('.story-title', 0)->plaintext; $item['intro'] = $article->find('.p', 0)->plaintext; $item['details'] = $article->find('.details', 0)->plaintext; $items[] = $item; } print_r($items); ``` -------------------------------- ### Check MkDocs Installation Version Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/README.md Commands to verify the installed version of MkDocs, ensuring it meets the minimum requirement (1.0.4 or higher) for building the project documentation. ```Shell mkdocs --version ``` ```Shell python3 -m mkdocs --version ``` -------------------------------- ### Modify HTML Documents (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/quick-start.md Demonstrates parsing an HTML string, modifying elements within the DOM using `find` and direct attribute access (magic methods), and then outputting the updated HTML string. This example shows how to change an element's class and inner text. ```php $doc = '
Hello,
World!
'; $html = str_get_html($doc); $html->find('div', 1)->class = 'bar'; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; //
foo
World!
``` -------------------------------- ### PHP: Example usage of save method Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/save.md Illustrates how to call the `save` method in PHP, both without arguments to get the document string and with a filepath to save to a file. ```php $string = $node->save(); $string = $node->save($file); ``` -------------------------------- ### Build MkDocs Project for Deployment Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/README.md Commands to build the final static site files for the MkDocs project. The generated HTML, CSS, and JavaScript files will be placed in the 'site' folder, ready for deployment to a web server. ```Shell mkdocs build ``` ```Shell python3 -m mkdocs build ``` -------------------------------- ### PHP addClass Method Usage Examples Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/addClass.md Examples demonstrating how to use the `addClass` method in PHP to add single, multiple space-separated, or array-based class names to a node object. ```php $node->addClass('hidden'); $node->addClass('article important'); $node->addClass(array('article', 'new')); ``` -------------------------------- ### PHP parent() Function API Reference Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/parent.md Detailed API documentation for the PHP `parent()` function, including its signature, parameters, and behavior for both getting and setting the parent node. ```APIDOC parent ( [ object $parent = null ] ) : object Parameter | Description --------- | ----------- `parent` | The parent node Returns the parent node of the current node if `$parent` is null. Sets the parent node of the current node if `$parent` is not null. In this case the current node is automatically added to the list of nodes in the parent node. ``` -------------------------------- ### Read Plain Text from HTML Document using PHP Simple HTML DOM Parser Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/quick-start.md Loads the specified HTML document from a URL into memory, parses it, and returns the plain text content. The `file_get_html` function supports both local and remote files. ```php echo file_get_html('https://www.google.com/')->plaintext; ``` -------------------------------- ### Read Plain Text from HTML Document (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/quick-start.md Demonstrates how to load an HTML document from a URL or local file using `file_get_html` and extract its plain text content. This method supports both remote and local file paths. ```php echo file_get_html('https://www.google.com/')->plaintext; ``` -------------------------------- ### HTML Document Structure Example for Node Types Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/definitions.md Illustrates various HTML elements and text content that correspond to different node types recognized by the parser, such as DOCTYPE, HTML tags, comments, and plain text. ```html Hello, World! ``` -------------------------------- ### PHP: Example usage of save method Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/save.md Illustrates how to call the `save` method in PHP, both to retrieve the document string and to save it to a specified file. ```php $string = $node->save(); $string = $node->save($file); ``` -------------------------------- ### Modify HTML Documents using PHP Simple HTML DOM Parser Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/quick-start.md Parses an HTML string, modifies elements within its DOM structure, and then outputs the updated HTML. This example changes the class of a div element and the inner text of another, showcasing direct attribute access via magic methods and the `find` method's ability to return specific matches. ```php $doc = '
Hello,
World!
'; $html = str_get_html($doc); $html->find('div', 1)->class = 'bar'; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; //
foo
World!
``` -------------------------------- ### Extract Specific Elements from HTML Document (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/quick-start.md Illustrates loading an HTML document and using CSS selectors with the `find` method to locate and iterate through specific elements, such as images and anchor links, extracting their attributes like `src` and `href`. ```php $html = file_get_html('https://www.google.com/'); foreach($html->find('img') as $element) echo $element->src . '
'; foreach($html->find('a') as $element) echo $element->href . '
'; ``` -------------------------------- ### HTML Document Structure Example for Node Types Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/definitions.md Illustrates various HTML elements and text within a single line to demonstrate how an HTML parser categorizes them into different node types, such as elements, comments, text, and unknown types (e.g., DOCTYPE). This example helps in understanding the parser's internal representation of a simple HTML document. ```html Hello, World! ``` -------------------------------- ### PHP: Examples of addClass Method Usage Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/addClass.md Illustrates various ways to use the `addClass` method in PHP, including adding a single class, multiple classes as a space-separated string, and multiple classes as an array. The method can accept a string or an array for the class names. ```php $node->addClass('hidden'); $node->addClass('article important'); $node->addClass(array('article', 'new')); ``` -------------------------------- ### Read Plain Text from HTML String (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/quick-start.md Shows how to parse a given HTML string, including partial documents, using `str_get_html` and retrieve its plain text content. The parser can handle incomplete HTML structures. ```php echo str_get_html('')->plaintext; ``` -------------------------------- ### PHP hasClass Method Usage Example Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/hasClass.md Illustrates a practical application of the `hasClass` method in PHP, demonstrating how to invoke it on a `$node` object to check for the existence of the 'article' class. ```php $node->hasClass('article'); ``` -------------------------------- ### PHP parent() Method API Documentation Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/parent.md Comprehensive API documentation for the `parent` method in PHP, outlining its signature, parameter details, return type, and dual functionality for getting or setting the parent node of an object. ```APIDOC parent ( [ object $parent = null ] ) : object Description: Returns the parent node of the current node if $parent is null. Sets the parent node of the current node if $parent is not null. In this case the current node is automatically added to the list of nodes in the parent node. Parameters: parent: Type: object Description: The parent node Returns: object ``` -------------------------------- ### Fetching Remote Content with cURL in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/faq.md This example provides an alternative method for fetching remote HTML content using PHP's cURL library. This is particularly useful when `allow_url_fopen` is disabled on the server, offering a robust way to retrieve web pages before parsing them with `str_get_html()`. ```PHP $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://????????'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); $str = curl_exec($curl); curl_close($curl); $html= str_get_html($str); ... ``` -------------------------------- ### Fetching Remote Content with cURL in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/faq.md This example provides an alternative method for fetching remote web page content using PHP's cURL library. It is particularly useful when `allow_url_fopen` is disabled on the server, offering a robust way to retrieve data before parsing it with `str_get_html`. ```PHP $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://????????'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); $str = curl_exec($curl); curl_close($curl); $html= str_get_html($str); ... ``` -------------------------------- ### Create HTML DOM Objects Functionally (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/manual/creating-dom-objects.md This PHP snippet demonstrates how to parse HTML content into a DOM object using functional helper functions. It shows examples for loading HTML from a direct string, a remote URL, and a local file path. This approach is often used with libraries like Simple HTML DOM Parser. ```php // Create a DOM object from a string $html = str_get_html('Hello!'); // Create a DOM object from a URL $html = file_get_html('http://www.google.com/'); // Create a DOM object from a HTML file $html = file_get_html('test.htm'); ``` -------------------------------- ### HTML Attribute Quoting and Flag Example Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/definitions.md Demonstrates different ways attributes can be quoted (double, single) and the presence of flag attributes (unquoted) within an HTML paragraph tag, used to identify quote types. ```html ``` -------------------------------- ### Dynamically Generate HTML Table with simple_html_dom in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/manual/adding-nodes.md This PHP example demonstrates how to create new HTML elements and append them to an existing DOM structure using the `simple_html_dom` library. It specifically shows how to build a table from an array of data, including creating table, row, header, and data cells, and setting attributes. The script initializes an HTML document, populates a table with ocean volume data, and then appends the generated table to the document's body. ```php

Volumes of the World's Oceans

EOD; /***************************** code *****************************************/ $html = str_get_html($doc); $body = $html->find('body', 0); $table = $html->createElement('table'); // Header row $tr = $html->createElement('tr'); foreach ($header as $entry) { $th = $html->createElement('th', $entry); $tr->appendChild($th); } $table->appendChild($tr); // Table data foreach ($data as $row) { $tr = $html->createElement('tr'); foreach ($row as $entry) { // (optional) Add info to the volume column if (is_numeric($entry)) { $value = number_format($entry); $td = $html->createElement('td', $value); $td->setAttribute('volume', $entry); } else { $td = $html->createElement('td', $entry); } $tr->appendChild($td); } $table->appendChild($tr); } $body->appendChild($table); echo $html . PHP_EOL; /** * Output (beautified) * * * * * * *

Volumes of the World's Oceans

* * * * * * * * *
OceanVolume (km^3)
Arctic Ocean18,750,000
Atlantic Ocean310,410,900
Indian Ocean264,000,000
Pacific Ocean660,000,000
Souce China Sea9,880,000
Southern Ocean71,800,000
* * */ ``` -------------------------------- ### HTML Attribute Whitespace Example Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/definitions.md Shows an HTML paragraph tag with varying whitespace around its attributes, illustrating how the parser captures and stores whitespace before attribute names, between names and equal signs, and between equal signs and values. ```html ``` -------------------------------- ### Serve MkDocs Project Locally Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/README.md Commands to run a local development server for the MkDocs project, allowing live preview of changes in a web browser at http://127.0.0.1:8000. ```Shell mkdocs serve ``` ```Shell python3 -m mkdocs serve ``` -------------------------------- ### API Documentation for prepare Function Parameters Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/prepare.md Details the parameters accepted by the `prepare` function, including their types and descriptions. This function initializes a DOM object from an HTML string. ```APIDOC prepare: Parameters: str: The HTML document string. lowercase: Tag names are parsed in lowercase letters if enabled. defaultBRText: Defines the default text to return for
elements. defaultSpanText: Defines the default text to return for elements. ``` -------------------------------- ### Find HTML Elements by Tag Name in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/manual/finding-html-elements.md Demonstrates how to locate HTML elements using their tag names. Examples include finding all occurrences of a tag, combining multiple tags, and selecting specific elements by their zero-based index (first, last, or Nth). ```php // Find all anchors, returns a array of element objects $ret = $html->find('a'); // Find all anchors and images, returns an array of element objects $ret = $html->find('a, img'); // Find (N)th anchor, returns element object or null if not found (zero based) $ret = $html->find('a', 0); // Find last anchor, returns element object or null if not found (zero based) $ret = $html->find('a', -1); ``` -------------------------------- ### Build MkDocs Project for Deployment Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/README.md Commands to generate the final static HTML files for the MkDocs project. The output files are placed in the 'site' folder, ready for deployment. ```Shell mkdocs build ``` ```Shell python3 -m mkdocs build ``` -------------------------------- ### Read Plain Text from HTML String using PHP Simple HTML DOM Parser Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/quick-start.md Parses a provided HTML string directly from memory and extracts its plain text content. The parser is capable of handling both partial and complete HTML documents. ```php echo str_get_html('')->plaintext; ``` -------------------------------- ### PHP prepare Function API Reference Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom/prepare.md API documentation for the `prepare` function, which initializes a DOM object from an HTML string. It accepts parameters to control tag name casing and default text for `
` and `` elements. ```APIDOC prepare ( string $str [, bool $lowercase = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT ]]] ) str: The HTML document string. lowercase: Tag names are parsed in lowercase letters if enabled. defaultBRText: Defines the default text to return for
elements. defaultSpanText: Defines the default text to return for elements. ``` -------------------------------- ### PHP simple_html_dom Constructor API Reference Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom/__construct.md Documents the `__construct` method of the `simple_html_dom` object, detailing its PHP signature, parameters with their types, default values, and descriptions, along with the return type. ```php __construct ( [ string $str = null [, bool $lowercase = true [, bool $forceTagsClosed = true [, string $target_charset = DEFAULT_TARGET_CHARSET [, bool $stripRN = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT [, int $options = 0 ]]]]]]]]) : object ``` ```APIDOC simple_html_dom::__construct Parameters: str (string, optional, default: null): The HTML document string. lowercase (bool, optional, default: true): Tag names are parsed in lowercase letters if enabled. forceTagsClosed (bool, optional, default: true): Tags inside block tags are forcefully closed if the closing tag was omitted. target_charset (string, optional, default: DEFAULT_TARGET_CHARSET): Defines the target charset for text returned by the parser. stripRN (bool, optional, default: true): Newline characters are replaced by whitespace if enabled. defaultBRText (string, optional, default: DEFAULT_BR_TEXT): Defines the default text to return for
elements. defaultSpanText (string, optional, default: DEFAULT_SPAN_TEXT): Defines the default text to return for elements. options (int, optional, default: 0): Additional options for the parser. Currently supports 'HDOM_SMARTY_AS_TEXT' to remove [Smarty](https://www.smarty.net/) scripts. Returns: object - The new simple_html_dom object. ``` -------------------------------- ### PHP Example: Check for Class with hasClass Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/hasClass.md Illustrates how to use the `hasClass` function in PHP to determine if a `$node` object has the 'article' class. This example demonstrates a common use case for checking element properties. ```php $node->hasClass('article'); ``` -------------------------------- ### PHP Example: Recursively Removing an HTML Table Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/remove.md This example demonstrates how to parse an HTML string, find a specific table element, and then use the `remove()` method to delete it from the DOM. The resulting HTML string after removal is also shown. ```php $html = str_get_html(<<< EOD
Title
Row 1
EOD ); $table = $html->find('table', 0); $table->remove(); echo $html; /** * Returns * * */ ``` -------------------------------- ### PHP Example: Removing an HTML table from DOM Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/remove.md A comprehensive example demonstrating how to parse an HTML string using `str_get_html`, find a specific element (a table), and then remove it from the DOM using the `remove()` method. It shows the resulting HTML after removal. ```php $html = str_get_html(<<
Title
Row 1
EOD ); $table = $html->find('table', 0); $table->remove(); echo $html; /** * Returns * * */ ``` -------------------------------- ### PHP Example: Removing a Table from HTML DOM Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/removeChild.md This PHP example demonstrates the usage of the `removeChild` function. It parses an HTML string, finds the `body` and `table` elements, and then removes the `table` from the `body` using `removeChild`, finally echoing the modified HTML. ```php $html = str_get_html(<<< EOD
Title
Row 1
EOD ); $body = $html->find('body', 0); $body->removeChild($body->find('table', 0)); echo $html; /** * Returns * * */ ``` -------------------------------- ### API Documentation for find Function Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom/find.md Detailed documentation for the `find` function, including parameter descriptions and return value information. ```APIDOC find: Parameters: selector: A CSS style selector. idx: Index of the element to return. lowercase: Matches tag names case insensitive when enabled. Returns: An array of matches or a single element if idx is defined. ``` -------------------------------- ### PHP createElement Function API Reference Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom/createElement.md Documents the `createElement` function in PHP, detailing its signature, purpose, required parameters, optional parameters, and the type of object it returns. ```APIDOC createElement ( string $name [, string $value = null ] ) : object Description: Creates a new element. Parameters: $name (string): Name of the element $value (string, optional): Value of the element Returns: object: The element. ``` -------------------------------- ### Manipulate HTML Element Attributes in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/manual/accessing-element-attributes.md Demonstrates how to get, set, remove, and check for the existence of attributes on an HTML element object in PHP. It clarifies that for non-value attributes (like 'checked' or 'selected'), getting returns true/false and setting accepts true/false. ```php // Get a attribute ( If the attribute is non-value attribute (eg. checked, selected...), it will returns true or false) $value = $e->href; // Set a attribute(If the attribute is non-value attribute (eg. checked, selected...), set it's value as true or false) $e->href = 'my link'; // Remove a attribute, set it's value as null! $e->href = null; // Determine whether a attribute exist? if(isset($e->href)) echo 'href exist!'; ``` -------------------------------- ### PHP Example: Removing a Table Element from HTML DOM Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/removeChild.md This PHP example demonstrates the practical application of the `removeChild` function. It parses an HTML string, locates a specific table element within the body, and then uses `removeChild` to remove that table from the DOM, illustrating the function's effect on the document structure. ```php $html = str_get_html(<<< EOD
Title
Row 1
EOD ); $body = $html->find('body', 0); $body->removeChild($body->find('table', 0)); echo $html; /** * Returns * * */ ``` -------------------------------- ### APIDOC: save method signature and parameters Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/save.md Documents the signature, parameters, and return value of the `save` method. ```APIDOC save ( [ string $filepath = '' ] ) : string Parameters: filepath: Writes to file if the provided file path is not empty. Returns: The document string. ``` -------------------------------- ### PHP firstChild Method API Documentation Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom/firstChild.md This snippet provides the API documentation for the `firstChild` method. It outlines the method's signature and describes its functionality, which is to return the first child object of the root element. ```APIDOC Method: firstChild Signature: firstChild () : object Description: Returns the first child of the root element. ``` -------------------------------- ### API Documentation for match Function Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/match.md Detailed API documentation for the `match` function, including descriptions for each parameter and its overall purpose. ```APIDOC match function: Description: Matches a single attribute value against the specified attribute selector. See Also: find Signature: match(string $exp, string $pattern, string $value, string $case_sensitivity) : bool Parameters: exp: Type: string Description: Expression pattern: Type: string Description: Pattern value: Type: string Description: Value case_sensitivity: Type: string Description: Case sensitivity Returns: bool ``` -------------------------------- ### Get HTML Text Representation (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/text.md Returns the (HTML) text representation for the current node recursively. ```php text ( ) : string ``` -------------------------------- ### Get HTML Text Representation (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/text.md This PHP function returns the (HTML) text representation for the current node recursively. ```php text ( ) : string ``` -------------------------------- ### createElement Function Definition and API Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/createElement.md This snippet provides the PHP function signature for `createElement` and its detailed API documentation, outlining parameters, their types, descriptions, and the function's return value. ```php createElement ( string $name [, string $value = null ] ) : object ``` ```APIDOC Function: createElement Signature: createElement ( string $name [, string $value = null ] ) : object Description: Creates a new element. Parameters: name (string): Name of the element value (string, optional, default: null): Value of the element Returns: object - The element. ``` -------------------------------- ### Get Parent Node in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/parentNode.md This method retrieves the parent node of the current object. It is a parameterless function that returns an object representing the parent. ```php parentNode () : object ``` -------------------------------- ### PHP Function Signature for prepare Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/prepare.md Defines the signature for the `prepare` function, including its parameters and their default values. This function is used to initialize a DOM object. ```php prepare ( string $str [, bool $lowercase = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT ]]] ) ``` -------------------------------- ### Get HTML Representation of Node (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/makeup.md This PHP function `makeup()` returns the HTML representation of the current node as a string. It takes no parameters. ```php makeup ( ) : string ``` -------------------------------- ### API Documentation for str_get_html Function Parameters Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/str_get_html.md Detailed API documentation for the `str_get_html` function, outlining its purpose and a description of each parameter. ```APIDOC str_get_html: Description: Parses the provided string and returns the DOM object. Parameters: str: The HTML document string. lowercase: Forces lowercase matching of tags if enabled. This is very useful when loading documents with mixed naming conventions. forceTagsClosed: Obsolete. This parameter is no longer used by the parser. target_charset: Defines the target charset when returning text from the document. stripRN: If enabled, removes newlines before parsing the document. defaultBRText: Defines the default text to return for
elements. defaultSpanText: Defines the default text to return for elements. ``` -------------------------------- ### Get Attribute Value (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/getAttribute.md Retrieves the value of a specified attribute by its name. This method is designed to fetch dynamic properties or data associated with an object or context. ```php getAttribute ( string $name ) : mixed ``` ```APIDOC Parameters: name: string - Attribute name. Returns: mixed - The value for the attribute $name. ``` -------------------------------- ### Get Last Child Node in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/lastChild.md This PHP function, `lastChild()`, returns the last child node as an object. It is implemented as a direct wrapper for the underlying `last_child` function. ```php lastChild ( ) : object ``` -------------------------------- ### APIDOC: load Function Parameters and Return Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/load.md Detailed API documentation for the `load` function, outlining its parameters, their types, descriptions, and the expected return type. ```APIDOC load(str: string, lowercase: bool = true, stripRN: bool = true, defaultBRText: string = DEFAULT_BR_TEXT, defaultSpanText: string = DEFAULT_SPAN_TEXT, options: int = 0) str: The HTML document string. lowercase: Tag names are parsed in lowercase letters if enabled. stripRN: Newline characters are replaced by whitespace if enabled. defaultBRText: Defines the default text to return for
elements. defaultSpanText: Defines the default text to return for elements. options: Additional options for the parser. Currently supports 'HDOM_SMARTY_AS_TEXT' to remove [Smarty](https://www.smarty.net/) scripts. Returns: object ``` -------------------------------- ### API Documentation for match Function Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/match.md Comprehensive API documentation for the `match` function, detailing each parameter's purpose and the overall functionality of the function. It explains how the function matches a single attribute value against a given pattern with specified case sensitivity. ```APIDOC match (protected) Parameters: exp (string): Expression pattern (string): Pattern value (string): Value case_sensitivity (string): Case sensitivity Description: Matches a single attribute value against the specified attribute selector. See also `find`. ``` -------------------------------- ### Get Current Node Name (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/nodeName.md This PHP function returns the name of the current node. It takes no parameters and returns a string representing the node's tag name. ```php nodeName ( ) : string ``` -------------------------------- ### Get Current Node Name (PHP) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/nodeName.md Returns the name of the current node (tag name). This method takes no parameters and returns a string representing the node's name. ```php nodeName ( ) : string ``` -------------------------------- ### PHP prevSibling Method Signature Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/prevSibling.md This code snippet shows the method signature for `prevSibling`. It indicates that the method takes no arguments and returns an object. This method is a direct wrapper for the underlying `previous_sibling` functionality. ```php prevSibling ( ) : object ``` -------------------------------- ### Get Last Child Node in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/last_child.md This function signature defines the `last_child` method, which returns the last child of the current node. It returns `null` if the current node has no child elements. ```php last_child ( ) : object ``` -------------------------------- ### Get Previous Sibling Node in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom_node/prev_sibling.md This function retrieves the immediately preceding sibling node of the current node. It returns an object representing the previous sibling, or `null` if no such sibling exists. ```php prev_sibling ( ) : object ``` -------------------------------- ### API Documentation for __get Accessible Properties Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/__get.md This section documents the specific properties that can be accessed via the `__get` magic method, providing a description for each. These properties typically relate to document parsing and content extraction. ```APIDOC __get(string $name): mixed Supports following names: outertext: Returns the outer text of the root element. innertext: Returns the inner text of the root element. plaintext: Returns the plain text of the root element. charset: Returns the charset for the document. target_charset: Returns the target charset for the document. ``` -------------------------------- ### API Documentation for PHP __set Magic Method Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/__set.md Detailed API documentation for the PHP `__set` magic method, outlining its parameters, their types, descriptions, and the method's specific behavior for setting 'outertext', 'innertext', or general attributes. ```APIDOC __set(string $name, mixed $value) name: string Description: `outertext`, `innertext` or attribute name. value: mixed Description: Value to set. Behavior: - Sets the outer text of the current node to `$value` if `$name` is `outertext`. - Sets the inner text of the current node to `$value` if `$name` is `innertext`. - Otherwise, adds or updates an attribute with name `$name` and value `$value` to the current node. ``` -------------------------------- ### API Documentation: str_get_html Function Parameters Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/str_get_html.md Detailed documentation for each parameter of the `str_get_html` function, outlining its type, purpose, and default value where applicable. This includes parameters for controlling case sensitivity, character encoding, newline stripping, and default text for specific HTML elements. ```APIDOC str_get_html function: Description: Parses the provided string and returns the DOM object. Parameters: str: Type: string Description: The HTML document string. lowercase: Type: bool Default: true Description: Forces lowercase matching of tags if enabled. This is very useful when loading documents with mixed naming conventions. forceTagsClosed: Type: bool Default: true Description: Obsolete. This parameter is no longer used by the parser. target_charset: Type: string Default: DEFAULT_TARGET_CHARSET Description: Defines the target charset when returning text from the document. stripRN: Type: bool Default: true Description: If enabled, removes newlines before parsing the document. defaultBRText: Type: string Default: DEFAULT_BR_TEXT Description: Defines the default text to return for
elements. defaultSpanText: Type: string Default: DEFAULT_SPAN_TEXT Description: Defines the default text to return for elements. ``` -------------------------------- ### Get Parent Node in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/parentNode.md This method returns the parent node of the current object. It is typically used in DOM manipulation or tree-like data structures to navigate upwards, providing access to the hierarchical parent. ```php parentNode () : object ``` -------------------------------- ### Get Outer HTML of Node in PHP Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom_node/outertext.md This function returns the complete HTML string representation of the current node, encompassing both its opening and closing tags. It's useful for retrieving the full structural content of an element. ```php outertext ( ) : string ``` -------------------------------- ### API Documentation for restore_noise Function Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/restore_noise.md Detailed API documentation for the `restore_noise` function, outlining its parameters and the expected return value. ```APIDOC restore_noise(text: string) -> string text: A string (potentially) containing noise placeholders. Returns: The string with original contents restored or the original string if it doesn't contain noise placeholders. ``` -------------------------------- ### Get First Child Element (PHP API) Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9_1/manual/docs/api/simple_html_dom/firstChild.md This snippet documents the `firstChild` method, which is used to retrieve the first child element of the current root element. It provides the method signature and a brief description of its functionality. ```APIDOC Method: firstChild Signature: firstChild () : object Description: Returns the first child of the root element. Return Type: object ``` ```php firstChild () : object ``` -------------------------------- ### PHP load Function Signature and API Documentation Source: https://github.com/datanfr/datan/blob/master/scripts/lib/simplehtmldom_1_9/manual/docs/api/simple_html_dom/load.md Comprehensive documentation for the PHP `load` function, including its signature, detailed parameter descriptions, and return type for parsing HTML document strings. ```php load ( string $str [, bool $lowercase = true [, bool $stripRN = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT [, int $options = 0 ]]]]]) : object ``` ```APIDOC load(string $str [, bool $lowercase = true [, bool $stripRN = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT [, int $options = 0 ]]]]]) : object\n str: The HTML document string.\n lowercase: Tag names are parsed in lowercase letters if enabled.\n stripRN: Newline characters are replaced by whitespace if enabled.\n defaultBRText: Defines the default text to return for
elements.\n defaultSpanText: Defines the default text to return for elements.\n options: Additional options for the parser. Currently supports 'HDOM_SMARTY_AS_TEXT' to remove Smarty scripts.\nReturns: object ```