Baidu thieves: getting rid of spot price and advertisement _ PHP Tutorial

Source: Internet
Author: User
Baidu thieves: removes bids and advertisements. 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 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.

 
 
  1. If (isset ($ _ GET [wd]) {
  2. $ Keywords = $ _ GET [wd];
  3. }
  4. $ Uri = isset ($ _ SERVER [HTTP_X_REWRITE_URL])? $ _ SERVER [HTTP_X_REWRITE_URL]: $ _ SERVER [REQUEST_URI];
  5. $ Content = file_get_contents ("http://www.baidu.com". $ uri );
  6. If ($ uri =/| empty ($ uri )){
  7. Display ($ content );
  8. }
  9. // Delete the "laibaidu promotion" LINK
  10. $ Start = preg_quote ("

    ");

  11. $ Content = preg_replace ("/". $ start ."((?!
    ).)*
    "."/Is ", $ content );
  12. // Delete the bid on the left
  13. $ Start =" ).) *> ";
  14. $ Content = preg_replace_callback ("/". $ start ."((?!).)*/Is "," search_result_filter ", $ content );
  15. // Delete the remaining multiple
  16. $ Content = str_ireplace ("

    ", $ Content );
  17. // Delete the remaining multiple
  18. $ Content = str_ireplace ("
    ", $ Content );
  19. // Delete the promotion link on the right
  20. $ Start = preg_quote ("

    ");

  21. $ Content = preg_replace ("/". $ start ."((?!

    ", $ Content );
  22. Display ($ content );
  23. /**
  24. * Search Result Filter
  25. */
  26. Function search_result_filter ($ matches ){
  27. // Background # f5f5f5 is an advertisement
  28. If (strpos ($ matches [0], "bgcolor =" # f5f5f5 "") return;
  29. // ID4-digit advertising
  30. If (preg_match ("/ ((?!).)*/Is ", $ matches [0]) {
  31. Return;
  32. }
  33. Return $ matches [0];
  34. }
  35. Function display ($ content ){
  36. Echo $ content;
  37. }

Bytes. The rewrite rules are consistent with those of Wordpress. Compatible with IIS, Apache, and Nginx. Only one file implements all functions. ? Php if (isset ($ _ GET [wd]) {$ keywords =$ _ GET [wd];} $ uri =...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.