We have html page, it has many code inside.
Sometimes it has block #container, sometimes not.
All code of this page is inside $page variable.
How do I:
- check, is there block with
id="container"? - if html page has
#containerinside, then get it contents of this block and write to a variable$container.
Task should be done by php.
One of the possible ways to solve your problem is to use third party library. Let’s say http://simplehtmldom.sourceforge.net/: