CodeIgniter Forums
googlebot detection problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: googlebot detection problem (/thread-13656.html)



googlebot detection problem - El Forum - 12-01-2008

[eluser]Unknown[/eluser]
User_agent.php in sys/libraries doesn't work with the googlebot user agent string:

Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

It finds the Mozilla/5.0 first and sets the user agent to browser.

Change the _compile_data() function to:
foreach (array('_set_robot', '_set_browser', '_set_mobile') as $function)

instead of:
foreach (array('_set_browser', '_set_robot', '_set_mobile') as $function)

to fix it.


googlebot detection problem - El Forum - 12-01-2008

[eluser]Unknown[/eluser]
Thanks!!

I was just looking through my logfiles, and was wondering why they were full of bots(2 mill entries, with a majority being bots).
I was using something like:
if ($this->agent->is_browser())
{
writeLog();
}

Now I'm looking into using BrowseCap (http://code.google.com/p/phpbrowscap/)
as it seems to be more accurate and detailed.