php - A few questions regarding $_SERVER['HTTP_USER_AGENT'] and using RegEx to extract information from the results -


OK, for example take this user agent:

Mozilla / 5.0 ( Windows; U; Windows NT 5.1; N-US; RV: 1.9.2.6) Geico / 20100625

Curious as to what all this means, I understand some things, obviously Is, like Mozilla == Firefox, and Windows NT 5.1 == Windows XP but RV What is: 1.9.2.6, and what is Gikko? And u?

Anyway, I'm working on installing scripts that put different pieces of it into different variables like Mozilla and Windows NT 5.1, but how I am using RegEx to remove it, If most of the other sections in the user agent (if not all) are dynamic based on each user?

Let's see: Mozilla / 5.0 (Windows; U; Windows NT 5.1; en- US; rv: 1.9.2.6) Geico / 20100625

  • Mozilla / 5.0 <- Codex artifacts from the era of dinosaurs; Nowadays, almost every browser identifies Mozilla (even IE, Chrome and Opera).
  • Windows
  • U
  • Windows NT 5.1
  • N-US - Browser locale - In this case, English-American
  • rv: 1.9.2.6 - Gecko renderer version
  • Gecko / 20100625 - Renderer Build Date: 2010-06-25

Anyway, this header is essentially meaningless, because many browsers To cheat it Provide ways (at least Firefox and Opera)


Comments