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

Ok, take this user agent, for example:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625

Curious what all this means. I can understand a few things, obviously, such as Mozilla == Firefox and Windows NT 5.1 == Windows XP. But what is rv: 1.9.2.6, and what is gecko? and u?

Also, I'm working on setting up a script that puts various parts of it in separate variables, such as Mozilla and Windows NT 5.1, but how can I use RegEx to extract this if most (if not all) of the other sections in the User Agent are dynamic based on each user?

+3
source share
5 answers

: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625

  • Mozilla/5.0 - ; Mozilla ( IE, Chrome Opera).
  • Windows -
  • U - (N " " I " " )
  • Windows NT 5.1 - . 5.1 - Windows XP, 6.0 - Vista, 6.1 - Windows " Vista SP" 7
  • en-US - - -
  • rv:1.9.2.6 - Gecko
  • Gecko/20100625 - : 2010-06-25

, , ( , Firefox Opera).

+2

Mozilla, , . . U " ()"; rv/xyz - Gecko.

, , PHP native get_browser().

+1

Maybe you should take a look at get_browser .

0
source

Source: https://habr.com/ru/post/1755464/


All Articles