How can I get a div content in php

Use the php DomDocument class. http://www.php.net/manual/en/class.domdocument.php

$dom = new DOMDocument();

$dom->loadHTML($html);

$xpath = new DOMXPath($dom);
$divContent = $xpath->query('//div[@id="product_list"]');

Leave a Comment