/** * Main function which will choose random browser * @param array $lang languages to choose from * @return string user agent */ function random_uagent(array $lang = array('en-US')) { list($browser, $os) = chooseRandomBrowserAndOs(); $proc = array('lin' => array('i686', 'x86_64'), 'mac' => array('Intel', 'PPC', 'U; Intel', 'U; PPC'), 'win' => array('foo')); switch ($browser) { case 'firefox': $ua = "Mozilla/5.0 " . firefox($os); break; case 'safari': $ua = "Mozilla/5.0 " . safari($os); break; case 'iexplorer': $ua = "Mozilla/5.0 " . iexplorer($os); break; case 'opera': $ua = "Opera/" . rand(8, 9) . '.' . rand(10, 99) . ' ' . opera($os); break; case 'chrome': $ua = 'Mozilla/5.0 ' . chrome($os); break; } $ua = str_replace('{proc}', array_random($proc[$os]), $ua); $ua = str_replace('{lang}', array_random($lang), $ua); return $ua; }
function randagent() { $arrsch = array_random(array('lin', 'mac', 'lin2')); //echo "$arrsch\n"; return firefox($arrsch); }