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

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -