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

What is the difference between single quoted string and double quoted string?

0 Answers  


What is polymorphism with example in php?

0 Answers  


Hello Friends,I am seeking for a job in php having 2yrs. exp.Please suggest any company openings.

1 Answers  


Is there any way to call a JAVASCRIPT function in PHP in AJAX

4 Answers  


What does the function get_magic_quotes_gpc() means?

0 Answers  






What are the advantages of indexes?

0 Answers  


What is the correct php command to use to catch any error messages within the code?

0 Answers  


Is php case sensitive?

0 Answers  


What types of loops exist in php?

0 Answers  


What is the role of php.ini file?

0 Answers  


what is constructor

0 Answers  


What are the difference between array_keys() and array_key_exists() in php?

0 Answers  


Categories