Functions are as follows. The rewrite rules are consistent with those of Wordpress. Compatible with IIS, Apache, and Nginx. Only one file implements all functions .? Phpif (isset ($ _ GET ['wd ']) {$ keywords = $ _ GET ['wd'];} $ uri = isset ($ _ SERVER ['http _ X_REWRITE_URL '] function example.
The rewrite rules are consistent with those of Wordpress.
Compatible with IIS, Apache, and Nginx.
Only one file implements all functions.
-
- If (isset ($ _ GET ['wd ']) {
- $ Keywords = $ _ GET ['wd '];
- }
- $ Uri = isset ($ _ SERVER ['http _ X_REWRITE_URL '])? $ _ SERVER ['http _ X_REWRITE_URL ']: $ _ SERVER ['request _ URI'];
- $ Content = file_get_contents ("http://www.baidu.com". $ uri );
-
- If ($ uri = '/' | empty ($ uri )){
- Display ($ content );
- }
-
- // Delete the "laibaidu promotion" LINK
- $ Start = preg_quote (" ");
- $ Content = preg_replace ("/". $ start ."((?!
).)*
"."/Is ",'', $ content );
-
- // Delete the bid on the left
- $ Start =" ).) *> ";
- $ Content = preg_replace_callback ("/". $ start ."((?! <\/Table>).) * <\/table>/is "," search_result_filter ", $ content );
-
- // Delete the remaining multiple
- $ Content = str_ireplace ("
\ N
",'', $ Content );
- // Delete the remaining multiple
- $ Content = str_ireplace ("
\ N ",'', $ content );
- // Delete the promotion link on the right
- $ Start = preg_quote (" ");
- $ Content = preg_replace ("/". $ start ."((?! ", $ Content );
-
- Display ($ content );
- /**
- * Search Result Filter
- */
- Function search_result_filter ($ matches ){
- // Background # f5f5f5 is an advertisement
- If (strpos ($ matches [0], "bgcolor = \" # f5f5f5 \ "") return '';
- // ID4-digit advertising
- If (preg_match ("/ ((?! <\/Table>).) * <\/table>/is ", $ matches [0]) {
- Return '';
- }
- Return $ matches [0];
- }
-
- Function display ($ content ){
- Echo $ content;
- }