dev-master
9999999-dev https://github.com/jorgecasas/htmldomparserPHP HTML DOM Parser
GPLv3
The Requires
- php >=5.3.0
by ITERNOVA
parser php html dom
Wallogit.com
2017 © Pedro Peláez
PHP HTML DOM Parser
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version., (*1)
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details., (*2)
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/., (*3)
Usage Example:
// Create a DOM object
$dom = new HTMLDOMParser\DOM();
// Load HTML from a string
$dom->load('
Hello World!
');
// Find an element
$element = $dom->find( 'div' );
// Modify elements
foreach( $dom->find( '.foo' ) as $element ) {
$element->innertext = 'Hi World!';
}
// Also... modify first div element style...
$dom->find( 'div', 0 )->style = 'border:1px solid #CCCCCC;';
// Or CSS classes... modify first div element...
$dom->find( 'div[id=hello_div]', 0 )->class = 'bar';
// Or content!
$dom->find( 'div', 0)->innertext = 'Hi again!';
// Return HTML from DOM tree
$str_html = $dom->get_html();
In order to use composer, complete your composer.json file with:, (*4)
{
"require": {
"jorgecasas/htmldomparser": "dev-master"
}
}
PHP HTML DOM Parser
GPLv3
parser php html dom