- stripos: documentation ( source)
- strtolower: documentation ( source)
<?php
function ff_iswebcrawler(){
$_SERVER = array('HTTP_USER_AGENT' => 'alsdkflsafgooglebot-mobilelkasjfal');
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
return (
stripos($ua,'googlebot-mobile') !== false
|| (stripos($ua,'iphone') !== false && stripos($ua,'googlebot') !== false)
);
}
if(ff_iswebcrawler())
{
echo 'yep';
}