What a robot!

Source: Internet
Author: User
Define (' Isrobot ', Getrobot ()), if (Defined (' Norobot ') && Isrobot) {Exit (header ("http/1.1 403 Forbidden");}

The above code, said to be to prevent the robot access, I do not understand where the representative is the machine person?

Judging the function of the robot is so written, what's the mystery?
function Getrobot () {if (!defined (' Is_robot ')) {$kw _spiders = ' bot| crawl| Spider|slurp|sohu-search|lycos|robozilla '; $kw _browsers = ' msie| netscape| opera| konqueror| Mozilla '; if (Preg_match ("/($kw _browsers)/", $_server[' Http_user_agent ')) {define (' Is_robot ', FALSE);} elseif (Preg_ Match ("/($kw _spiders)/", $_server[' Http_user_agent ')) {define (' Is_robot ', TRUE);} else {define (' Is_robot ', FALSE);}} return Is_robot;}


Reply to discussion (solution)

bot-Microsoft's Bing
spider-Baidu
slurp-Yahoo
The other few do not know, but this can only prevent normal crawling, people who forged or not can not prevent

bot-Microsoft's Bing
spider-Baidu
slurp-Yahoo
The other few do not know, but this can only prevent normal crawling, people who forged or not can not prevent


Isn't there a good one to run?

Rogue to catch also no way, but the general search engine follow robots protocol

Rogue to catch also no way, but the general search engine follow robots protocol


$kw _spiders = ' bot| crawl| Spider|slurp|sohu-search|lycos|robozilla '; What do you mean?

Bot| crawl| Spider|slurp|sohu-search|lycos|robozilla
It's a regular pattern to match.
Bot,spider ... Is a spider's logo, the general search engine will write

  • 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.