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
- What is Search Engine and Google Page Ranking?
- Use EJS as Template Engine in Node.js
- How to use underscore.js as a template engine ?
- How to Setup View Engine in Node.js ?
- How to Setup Handlebars View Engine in Node.js ?
- Express.js app.engine() Function
- How to detect a mobile device using PHP?
- How to detect Browser Language in PHP?
- How to detect a mobile device in jQuery?
- How to detect escape key press using jQuery?
- JQuery | Detect a textbox content is changed or not
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.