Jyoti Sandhiya
Jyoti Sandhiya

Reputation: 173

How to get visitor device Information

How to get complete device information of users using PHP or Javascript.

  1. Device Info (Eg Mobile, PC, Tablet)
  2. OS information (Eg Windows, Linux, Android, IOS)
  3. Brand Name (Eg Samsung, Apple, Lenovo etc)
  4. Browser (Eg Chrome, Firefox)
  5. OS Version (Eg, Windows 8, windows 10, Android 8 etc)

Upvotes: 3

Views: 4754

Answers (3)

SachinPatil4991
SachinPatil4991

Reputation: 774

Use Browsecap database for this purpose.

get_browser function from php uses user agent to get Information about device , os , browser etc.

You need to regularly update browsecap.ini file regularly to keep updated with latest Devices and Browsers.

Installation : download browsecap.ini from

https://browscap.org

Move file to

/etc/php.d/browscap.ini

Then add below lines to php.ini

[browscap]
; http://php.net/browscap
browscap = "/etc/php.d/browscap.ini"


Restart webserver to apply changes

And now you can use get_browser() function

<?php
$browser = get_browser(); 
print_r($browser);
?>

Upvotes: 1

Sports
Sports

Reputation: 15

You can get easily using PHP.

echo $_SERVER['HTTP_USER_AGENT'];

Or,

$browserInfo = get_browser(null, true);
print_r($browserInfo);

Upvotes: 1

Gozbeth Stanslaus
Gozbeth Stanslaus

Reputation: 121

Check the below links will help you get started on that issue https://www.visitorjs.com/ https://tutorialedge.net/javascript/retrieving-visitor-information-javascript/

Upvotes: 0

Related Questions