title: How can one detect a crawler / spider using PHP?
body: <p><strong>How can one detect a crawler / spider using PHP?</strong></p>
  
  <p>I'm currently working on a project where I need to keep track of each crawler's visit.<br>
  I know that you should use HTTP_USER_AGENT but I'm not really sure how to format the code for this purpose and i know that the USER AGENT can be changed very easy so <strong>i would also like to know if it is possible to add some more parameters to avoid spoofing?</strong></p>
  
  <p>Sample code of what i'm trying to do..</p>
  
  <pre><code>&lt;?php
  $user_agent = $_SERVER['HTTP_USER_AGENT'];
  if (strpos( $user_agent, 'Google') !== false)
  {
  echo "Googlebot is here";
  }
  ?&gt;
  </code></pre>
  
  <p>Thank you</p>