Jump to content

Get div tag using php

- - - - -

  • Please log in to reply
2 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
hi guys

i want get <div class="winner"> in this code:

<div class="basic">

 <div class="math">

  <div class="winner">

   <div class="under">

    <div class="checker">

     <strong>check</strong>

    </div>

   </div>

  </div>

 </div>

</div>


after get show:
  <div class="winner">

   <div class="under">

    <div class="checker">

     <strong>check</strong>

    </div>

   </div>

  </div>
help me
thank you

#2
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Depending on what you are trying to accomplish PHP may not be the best solution. If you use a JavaScript framework like jQuery or MOOTools you can easily select it:

<script type="text/javascript">
//jQuery
alert($('div.winner').html());
</script>

If you are set on PHP you can use a built in feature:
PHP: DOM - Manual

Or possibly an external library I find very useful:
phpquery - Project Hosting on Google Code

#3
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
i want use preg

help me plz




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users