CopyCode The Code is as follows: <? PHP
$ Search = array ("'<SCRIPT [^>] *?>. *? </SCRIPT> 'si ", // remove Javascript
"'<Style [^>] *?>. *? </Style> 'si ", // remove CSS
"'<[/!] *? [^ <>] *?> 'Si ", // remove the HTML Tag
"'<! -- [/!] *? [^ <>] *?> 'Si ", // remove the annotation mark
"'([Rn]) [s] +'", // remove the white space
"'& (Quot | #34);' I", // replaces the HTML Object
"'& (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 (1, 161 ),
CHR (1, 162 ),
CHR (1, 163 ),
CHR (1, 169 ),
"CHR (\ 1 )");
// $ Document is the string to be processed. if the source is a file, you Can $ document = file_get_contents ('HTTP: // www.sina.com.cn ');
$ Out = preg_replace ($ search, $ replace, $ document );
Echo $ out;
?>
Save it as get. php.