What is robot!

Source: Internet
Author: User
What is robot!
define('ISROBOT', getrobot());if(defined('NOROBOT') && ISROBOT) {exit(header("HTTP/1.1 403 Forbidden"));}

The code above is said to prevent robot access. I don't understand where it represents a bot.

This is how the robot's function is written. Is there any xuanjicang in it?
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
Others do not know, but this can only prevent normal crawling. if someone spoofs it, it cannot prevent it.

Bot-Microsoft's bing
Spider-Baidu
Slurp-Yahoo
Others do not know, but this can only prevent normal crawling. if someone spoofs it, it cannot prevent it.


Isn't it easy?

Hooligans can't grasp the issue, but general search engines follow the robots protocol.

Hooligans can't grasp the issue, but general search engines follow the robots protocol.


$ Kw_spiders = 'bot | Crawl | Spider | slurp | sohu-search | lycos | robozilla ';

Bot | Crawl | Spider | slurp | sohu-search | lycos | robozilla
Is the regular expression pattern to be matched
Bot, Spider... are all Spider identifiers.

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.