<?php
function remove_script_tags($html){
$dom = new DOMDocument();
$dom->loadHTML($html);
$script = $dom->getElementsByTagName('script');
$remove = [];
foreach($script as $item){
$remove[] = $item;
}
foreach ($remove as $item){
$item->parentNode->removeChild($item);
}
$html = $dom->saveHTML();
$html = preg_replace('#<script src(.*?)>(.*?)</script>#is', '', $html);
$html = str_replace('</p></body></html>', '', $html);
return $html;
}
$s = [];
$s = [];
$s[] = " <script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>";
$sq[] = " <script>
SC.initialize({
client_id: '192.168.1.41',
redirect_uri: 'https://example.com/callback'
});
SC.connect().then(function () {
return SC.get('/me');
}).then(function (me) {
alert('Hello, ' + me.username);
});
</script>
<script src="https://connect.soundcloud.com/sdk/sdk-3.3.2.js"></script>
<!-- Soundcloud - END -->";
$s[] = "<!-- Google Adsense - Start -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1234567890123456" data-ad-slot="1234567890"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!-- Google Adsense - END -->";
$s4[]=" <!-- Youtube - Start -->
<iframe id="ytplayer" type="text/html" width="720" height="405"
src="https://www.youtube.com/embed/MswordkJksdNm7lc1UVf-VE" frameborder="0" allowfullscreen>
<!-- Youtube - END -->"
foreach($sq as $t){
echo $t.' ==> '.remove_script_tags($t)."\n";
}
- Output for 8.0.1 - 8.0.28, 8.1.0 - 8.1.19, 8.2.0 - 8.2.6
- Parse error: syntax error, unexpected identifier "https" in /in/LfMlO on line 52
Process exited with code 255.
preferences:
20.25 ms | 405 KiB | 5 Q