Remove all js HTML and CSS code from PHP
- 2020-03-31 21:09:52
- OfStack
<?php
$search = array ("'<script[^>]*?>.*?</script>'si", //Remove the javascript
"'<style[^>]*?>.*?</style>'si", //Remove the CSS
"'<[/!]*?[^<>]*?>'si", //Remove HTML tags
"'<!--[/!]*?[^<>]*?>'si", //Uncomment markup
"'([rn])[s]+'", //Get rid of the whitespace
"'&(quot|#34);'i", //Replace HTML entities
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'(d+);'e"); //Run as PHP code
$replace = array ("",
"",
"",
"",
"1",
""",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169),
"chr(1)");
//$document = file_get_contents('http: arbitration www.sina.com.cn'); $document = file_get_contents('http: arbitration www.sina.com.cn');
$out = preg_replace($search, $replace, $document);
echo $out;
?>
Save it as get.php.