how to extract a tag with a class name's innerhtml

Discussion in 'PHP' started by gilgalbiblewheel, Mar 18, 2010.

  1. #1
    I need to get the innerHTML of the maintext class name of a table tag.
    If I use:
    $dom = new SimpleXMLElement(file_get_contents($file));//line 87
    $tables = $dom->xpath('//table[@class="maintext"]'); 
    print_r($tables);
    PHP:
    I get:
    On the other hand if I use:
    DOMElement
    //SimpleXMLElement
    $dom = new DOMElement(file_get_contents($file)); // line 88
    $table = $dom->xpath('//table[@class="maintext"]');  
    print_r($table);
    PHP:
    I get:
     
    gilgalbiblewheel, Mar 18, 2010 IP