<html>
<head><title>bla bla</title></head>
<body>
<div id="mainContent" xmlns:h="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml">
bla bla .....
</div>
</body>
</html>
I need to extract that division. How can I do it using PHP 5?
The html source is not currectly formatted. There are some undefined attributes.
If your HTML is not well formed, you can still use stuff like
DOMDocument, e.g.:Alternatively, just prefix the HTML with
<!DOCTYPE html>so that you can usegetElementByIdas per normal.