Search engine bots (sometimes called spiders or crawlers) are computer programs(bots) that crawl the web pages. In other words, they visit webpages, find links to further pages, and visit them. Often they map content that they find to use later for search purposes (indexing). They also help developers diagnose issues with their websites.
PHP doesn’t have any built-in function to detect search engine bots. However, the following function can be used for this purpose.
This function compares the PHP user agent with a list of common spiders from search engines, more than 180 bots, spiders and crawlers.
When ‘Googlebot’ is given as input, the function returns true(1) as the provided input is the name of a search engine bot.
- Search Engine Optimization (SEO) | Basics
- Mobile Search Engine Optimization (SEO)
- Elasticsearch Search Engine | An introduction
- Difference between Search Engine and Web Browser
- Use EJS as Template Engine in Node.js
- How to detect the change in DIV's dimension ?
- How to detect when user scrolls to the bottom of a div ?
- How to detect a mobile device in jQuery?
- How to detect the user's device using jQuery ?
- How to detect escape key press using jQuery?
- How to detect HTML 5 is supported or not in the browser ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.