PHP to get the particular div content from loadHTML()

by Subramanian 2014-02-21 12:55:21

PHP to get the particular div content from loadHTML() :

The following php code is used to get the particular div content from html code.

$dom = new DOMDocument();

$dom->loadHTML($html);

$xpath = new DOMXPath($dom);

$div = $xpath->query('//div[@id="main_content"]');

$div = $div->item(0);

$mainCOn= $dom->saveXML($div);

887
like
0
dislike
0
mail
flag

You must LOGIN to add comments