I am parsing data from html using PHP Simple HTML DOM parser.
$html = file_get_html('www.example.com');
$e= $html->find('div[class=BodyContent]');
The variable $e contains html data (divs, imgs, etc). If I echo it on the screen with a foreach loop, it prints out on the screen perfectly. How can I convert this $e to a string? My goal is for it to look like this and use:
$x = str_get_html('<div id="BodyContent">Hello</div>
<div id="world">World</div>...otherData');
How can I do this so $e content displays as regular HTML inside str_get_html?
Update: The variable $e should contain HTML data after parsing:
<div id="BodyContent">
<div id="somethingelse>
<p>Some more content</p><a>Some links</a>
<span></span>
</div>
The function from SimpleHtmlDom requires parameter 1 to be a string so...I want to convert the variable $e to a string so all these divs and paragraphs can be inserted into the str_get_html('HERE').