Get html block by PHP -


we have html page, has many code inside.

sometimes has block #container, not.

all code of page inside $page variable.

how i:

  1. check, there block id="container"?
  2. if html page has #container inside, contents of block , write variable $container.

task should done php.

one of possible ways solve problem use third party library. let's http://simplehtmldom.sourceforge.net/:

$html->load($page); if ($html->find('#container')) $container = $html->find('#container'); 

Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -