I am trying to extract the content of a <div>
nested inside a <code>
tag with PHP Simple HTML DOM Parser but I am always getting the error Trying to get property of non-object in...
as if the parser was finding nothing inside my <div>
The code I'm using is
include_once('simplehtmldom_1_5/simple_html_dom.php');
// Create a DOM object
$html = new simple_html_dom();
// Load HTML
$html->load('<code><div>hello</div></code>');
// Extract div content
echo $html->find('div',0)->innertext;
But if instead of using <code><div>hello</div></code>
as my sample code i use <span><div>hello</div></span>
it works... it seems like I'm having problems only looking inside the code
tag.
What's wrong with what i'm doing? Hope you guys can point me in the right direction, thank you very much for your support!