0

We are looking to view and modify the particular element using Simple PHP DOM,

<?php     
    include('../../../../dom/simple_html_dom.php');
    $html = new simple_html_dom();
    $html->load_file('http://www.google.com');   

    foreach ($tags as $tag)
    {           
        //something like that match with $string, if value found then the particular element edited by the <u>$string</u>.
        if(stristr($tag->innertext,$string)) {}    
    }

    echo $html ; 
?>

We want to get all HTML elements, in array. We have to check each element, and if one is matching with our data, then we moderate that particular element.

Adinia
  • 3,722
  • 5
  • 40
  • 58
Sam
  • 53
  • 1
  • 2
  • 9

1 Answers1

0

You can try the folloing to extract all <ul> .. </ul>

include 'simple_html_dom.php';
$html = file_get_html('http://www.yahoo.com/');
foreach($html->find('ul') as $element)
    echo $element->plaintext . '<br>';
Baba
  • 94,024
  • 28
  • 166
  • 217
  • we are finding UL elements, we have to get all of the tags (

    • etc...) in body of the particular url. is there any other dom, who can do the same job ?
    – Sam Sep 27 '12 at 08:59
  • You can use `$element->outertex` – Baba Sep 27 '12 at 09:02
  • but that is only for tag, we have to match it on each element like if body of the yahoo.com having more than 25 elements (

    • etc...), then we have to match each element's innertext with our variable $string.
    – Sam Sep 27 '12 at 09:04