Some time ago i wrote a simple regex patterns to determine whether my client crawler bot, mobile client or just regular one. Easy to expand and to use.
function is_mobile($agent) { $pattern = '/(blackberry|motorokr|motorola|sony|windows ce|240x320|176x220|palm|mobile|iphone|ipod|symbian|nokia|samsung|midp)/i'; return (bool)preg_match($pattern, $agent); } function is_crawler($agent) { pattern = '/(google|yahoo|baidu|bot|webalta|ia_archiver)/'; return (bool)preg_match($pattern, $agent); }

