cba
cba

Reputation: 135

PHP get browser: confusing output

I have a list containing information on the user's web browser. The list was generated by PHP through a user requirements survey. The output looks like this: (sample):

Which is the actual web browser? According to the PHP manual, it would be [parent], [platform], [browser], [version], but why does it say Safari and Chrome in one row, and why does "MSIE" appear inside the brackets?

Upvotes: 5

Views: 631

Answers (3)

Martin
Martin

Reputation: 6687

The first part means it's Mozilla 5.0 compatible - it's there for historical reasons and has no real use anymore, some browsers list other engines they support too. Then it is followed by Platform, Browser and build number/revision.

You may wish to use get_browser to help parse it.

Upvotes: 1

Gerald Versluis
Gerald Versluis

Reputation: 34013

These things identify the user agent. But it looks like per platform or something the layout is a bit different.

I don't know what you would want to do with them but maybe this is of any help; http://www.useragentstring.com/

They also have an API with which you can get all the info you want.

Upvotes: 2

hjpotter92
hjpotter92

Reputation: 80639

As read from PHP's get_browser() documentation:

For an output like: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3, the following information is fetched:

[browser_name_regex] => '^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$'
[browser_name_pattern] => 'Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*'
[parent] => 'Firefox 0.9'
[platform] => 'WinXP'
[browser] => 'Firefox'
[version] => 0.9
[majorver] => 0
[minorver] => 9
[cssversion] => 2
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[vbscript] =>
[javascript] => 1
[javaapplets] => 1
[activexcontrols] =>
[cdf] =>
[aol] =>
[beta] => 1
[win16] =>
[crawler] =>
[stripper] =>
[wap] =>
[netclr] =>

Upvotes: 0

Related Questions