1

I am using php simple html dom with the code bellow to get some content. My problem is that i don't want to grab google adsense code

html Structure:

<div class="post-single-content box mark-links">

Text text text text text

//adsense code here
</div>

And i an using the code bellow to get the content:

foreach($html->find('div[class=post-single-content box mark-links]') as $table)
{
$arr44[]=  $table->innertext ;
}

How can avoid or remove or bypass to grab the google adsense code? I don't need it!

Also tried the code bellow without any luck

$arr44d = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $arr44);

Cheers!!

Irene T.
  • 1,393
  • 2
  • 20
  • 40
  • 1
    try setting the `->outertext = ''` as an empty string, might remove those, you'll need to traverse the children though, http://stackoverflow.com/questions/8227481/simple-html-dom-how-to-remove-elements – Kevin May 06 '15 at 13:29
  • 1
    Actually, your regex works: https://ideone.com/5l8Lik. Please check delimiters, try with `#`, e.g. – Wiktor Stribiżew May 06 '15 at 14:22

0 Answers0