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.
- Mobile Search Engine Optimization (SEO)
- Difference between Search Engine and Web Browser
- Elasticsearch Search Engine | An introduction
- Search Engine Optimization (SEO) | Basics
- What is Search Engine and Google Page Ranking?
- How to use underscore.js as a template engine ?
- Use EJS as Template Engine in Node.js
- How to Setup View Engine in Node.js ?
- How to Setup Handlebars View Engine in Node.js ?
- How to detect Browser Language in PHP?
- How to detect a mobile device using PHP?
- How to detect the change in DIV's dimension ?
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.