0

I have looked around laracast and stack overflow but couldn't find a way to find a user's OS without using some sort of 3rd party tracker.

In codeigniter, it was really simple. How can I get the user OS using Laravel?

Request::server('HTTP_USER_AGENT')

That gets me the entire user agent string. I just want the OS.

Is it possible?

Limon Monte
  • 52,539
  • 45
  • 182
  • 213
Taylor
  • 2,981
  • 2
  • 29
  • 70

1 Answers1

0

In general, the HTTP_USER_AGENT is merely a HTTP header that is transferred by the client. It is a string, and therefore, depending on what exactly is transferred, one can extract the OS information from it or not.

There are several solutions, popular ones being e.g. terawurfl and others.

That said, there is no really reliable way to determine the users OS in Laravel or PHP at all, as it solely depends on the headers that the client is sending, whether you have a chance at all or not.

ArSeN
  • 5,133
  • 3
  • 19
  • 26