How to Get Inner HTML with DomDocument

Discussion in 'PHP' started by AHA7, Nov 20, 2007.

  1. #1
    Hello,

    How can I get the inner HTML of an element with DomDocument() functions.

    For example: how can I get "inner text" from the following tag:
    <p class="normal">inner text</p>?

    $domPage = new DomDocument();
    @$domPage->loadHTML($html);
    foreach ($domPage->getElementsByTagName('p') as $p_tag)
       {
           // How can I now get the inner HTML of each <p> tag?
       }
    
    PHP:
     
    AHA7, Nov 20, 2007 IP
  2. *louie*

    *louie* Peon

    Messages:
    48
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you try preg_match ?
     
    *louie*, Nov 20, 2007 IP