0

Looking for a better and affective PHP code to detect Search Engine Bots like google bot, Please need recommendation the code below is working perfect or any other code that perform much better then this?

function _bot_detected() {
   return (
      isset($_SERVER['HTTP_USER_AGENT'])
      && preg_match('/bot|crawl|slurp|spider|mediapartners/i', $_SERVER['HTTP_USER_AGENT']);
}

Regards

Khan
  • 1
  • Does this answer your question? [how to detect search engine bots with php?](https://stackoverflow.com/questions/677419/how-to-detect-search-engine-bots-with-php) – Nico Haase Nov 23 '21 at 14:20
  • Or this? https://stackoverflow.com/questions/19980363/how-can-one-detect-a-crawler-spider-using-php – Nico Haase Nov 23 '21 at 14:20
  • Or this? https://stackoverflow.com/questions/422969/how-to-recognize-bots-with-php – Nico Haase Nov 23 '21 at 14:21

0 Answers0