How do you get the Browser information?

Answers were Sorted based on User's Feedback



How do you get the Browser information?..

Answer / jahanvi

get_browser() attempts to determine the capabilities of the
user's browser. This is done by looking up the browser's
information in the browscap.ini file.

echo $_SERVER['HTTP_USER_AGENT'] . "<hr />\n";

$browser = get_browser();

foreach ($browser as $name => $value) {
echo "<b>$name</b> $value <br />\n";
}

Is This Answer Correct ?    8 Yes 3 No

How do you get the Browser information?..

Answer / ram

<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>

Is This Answer Correct ?    3 Yes 0 No

How do you get the Browser information?..

Answer / ravi rajendra k

If you need a parser for getting OS, browser name and version details, use this pattern in a preg_match_all function.

$pattern = '#(?<browser>' . join('|', $known) .')[/ ]+(?<version>[0-9]+(?:\.[0-9]+)?)#i';

You can see my article www.peacemax.com/11/php/user-agents-php-snippet where i wrote the entire function for getting those details.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More PHP Interview Questions

1.What is application server ? 2.What is web server ? 3.Explain the process of execution of a php file ?

9 Answers   IBM,


What is difference between strstr() and stristr()?

0 Answers  


How to create the PHP Script to Calculate the Age Using the Inputs Of our Birth date and the Current date?

6 Answers  


What is the use of isset() in php?

0 Answers  


So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?

0 Answers  






what are the current or latest versions of LAMP ? Linux, Apache, MySql, PHP

4 Answers  


What are the final class and final method?

0 Answers  


Which library is used in php to do various types of image work?

0 Answers  


How to store the uploaded file to the final location?

0 Answers  


Which function would you use to replace a record in a database in php?

0 Answers  


What is meant by pdo in php?

0 Answers  


What are properties in php?

0 Answers  


Categories