]*>(.*?)<\/p>/s', $page, $m); $agents = array(); foreach($m[2] as $agent) { $split = explode("\n", trim($agent)); foreach($split as $item) { $agents[] = trim($item); } } $page = file_get_contents('http://www.zytrax.com/tech/web/browser_ids.htm'); preg_match_all('/<(p) class="g-c-[ns]"[^>]*>(.*?)<\/p>/s', $page, $m); foreach($m[2] as $agent) { $split = explode("\n", trim($agent)); foreach($split as $item) { $agents[] = trim($item); } } $browser_found = 0; $platform_found = 0; $engine_found = 0; // $agents now holds every user agent string, one per array index, trimmed foreach($agents as $agent) { if (Fast_UA_finder::getPlatform($agent)) $platform_found++; if (Fast_UA_finder::getBrowser($agent)) $browser_found++; if (Fast_UA_finder::getEngine($agent)) $engine_found++; } header('Content-Type: text/plain'); echo (($platform_found / count($agents)) * 100) . "% of platforms identified (" . (count($agents) - $platform_found) . " not found)\n"; echo (($browser_found / count($agents)) * 100) . "% of browsers identified (" . (count($agents) - $browser_found) . " not found)\n"; echo (($engine_found / count($agents)) * 100) . "% of engines identified (" . (count($agents) - $engine_found) . " not found)\n"; ?>