1

I am using simple html dom parser with php to parse a link using below code.

foreach($html->find('div#ProductDescription_Tab') as $description)
{
    $comments = $description->find('.hsn_comments', 0); 
      $comments->outertext = ''; 


     echo $description->outertext;

}

This gives me the parsed data along with javascript "script" tags. How can I remove these script tags?

1 Answer 1

1

Ok So i figured out myself just use Advanced Html Dom library its totally compatible with simple html dom & by using it you will get much more control. Its very simple to remove what you want from parsed html. For Ex.

//to remove script tag
$scripts = $description->find('script')->remove;

//to remove css style tag
$style = $description->find('style')->remove;

// to remove a div with class name findify-element
$findify = $description->find('div.findify-element')->remove;

https://sourceforge.net/projects/advancedhtmldom/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.