php - making two different class names together in the same h3 tag in code retrieved from remote source -


i working getting html source code remote page removing tbody s

the source echo in page works problem stuck @

want put 2 class name in same h3 tag way code can display

properly in page

<?php     //get url     $url = "http://lsh.streamhunter.eu/static/section35.html";     $html = file_get_contents($url);     $doc = new domdocument(); // create domdocument     libxml_use_internal_errors(true);     $doc->loadhtml($html); // load html can add $html      $elements = $doc->getelementsbytagname('tbody');      $toremove = array();      // gather list of tbodys remove     foreach($elements $el)       if((strpos($el->nodevalue, 'desktop') !== false) && !in_array($el->parentnode, $toremove, true))         $toremove[] = $el->parentnode;                  foreach($elements $el)       if((strpos($el->nodevalue, 'recommended') !== false) && !in_array($el->parentnode, $toremove, true))         $toremove[] = $el->parentnode;        // remove them     foreach($toremove $tbody)       $tbody->parentnode->removechild($tbody);      echo $doc->savehtml(); // save new html ?> 

how can make 2 class names eventtitle , lshjpane-toggler lshtitle

to in same h3 tag no each in separate tag

edit: make clear @ code

<h3 class="lshjpane-toggler lshtitle eventtitle150909" onclick="getevent(150909)"></h3><table cellpadding="0" cellspacing="0" border="0"><tr><td valign="middle" width="20px;" height="20px;" style="padding:0px 0px 0px 5px; background: url(/images/stories/kr.png) no-repeat scroll center;"></td> <td valign="middle" style="padding:0px 0px 0px 5px;"><span class="lshstart_time">12:00</span></td> <td valign="middle" style="padding:0px 0px 0px 5px;"><span class="lshevent">daekyo kangaroos women - incheon red angels women</span></td> </tr></table><h3 id="preloadevent150909" style="display:none" class="preload-lshjpane-toggler"></h3>

it display if </h3> before <table removed

how can remove tag code retrieved remote page

if on place store whole page in variable before display.

$page = $doc->savehtml(); 

then repalce </h3><table, <table.

$page = str_replace('</h3><table', '<table', $page); 

then echo result:

echo $page; // echo $page 

but i'm afraid main problem <table> can not putted <h3> , that's why don't code wish have.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -