<?PHP
error_reporting(E_ALL ^ E_NOTICE);
//instantiate the class
include('html.parser.class.php');
$parser = new html_parser;
//use this method to load the markup as a file
//comment the line below if you are using the string method
$parser->loadFile('example.html');
//use this method to load the markup as a string
//uncomment both lines to load as a string
//$page = file_get_contents('example.html');
//$parser->loadString($page);
//uncomment the method you want to use to process the markup
//processDocument will parse the entire markup
//processTagName will parse the document for the specified tag name, set option to true to include descendents
//processElementID will parse and return the tag name of the element containing the specified id
$parseResult = $parser->processDocument();
//$parseResult = $parser->processTagName('p',false);
//$parseResult = $parser->processElementID('salesTable');
if( empty($parser->error) ){
echo $parser->showResult($parseResult);
}else{
echo $parser->error;
}
?>
|