Update1: With the full source code:
$html1 = '<div class="pubanunciomrec" style="background:#FFFFFF;"><script type="text/javascript"><!--
google_ad_slot = "9853257829";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>';
$doc = phpQuery::newDocument($html1);
$html1 = $doc->remove('script');
echo $html1;
The source code is this the above. I have also read that exists a bug, http://code.google.com/p/phpquery/issues/detail?id=150 I don't know if it is solved.
Any clues on how to remove the <script> from this HTML?
Best Regards,
Hi,
I need to remove all <script> tags from a HTML document using PhpQuery.
I have done the following:
$doc = phpQuery::newDocument($html);
$html = $doc['script']->remove();
echo $html;
It is not removing the <script> tags and contents. It is possible to do this with PhpQuery?
Best Regards,
This works:
$html->find('script')->remove();
echo $html;
This doesn't work:
$html = $html->find('script')->remove();
echo $html;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With