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 main difference between require() and include()?

0 Answers  


Describe session in php.

0 Answers  


Should I use mysqli or pdo?

0 Answers  


What is php explain?

0 Answers  


Binary tree question - Node has numeric data (int) The function takes depth as argument and sum all the value of the node of the depth. For instance, (0) depth 0 / \ 10 20 depth 1 / \ / \ 40 50 60 70 depth 2 so if you pass get_sum(2), you would return 220 which is 40+50+60+70 (sum of depth2) write the function.

0 Answers   Amazon, FGD,






Can I write php code in html file?

0 Answers  


What is "print" in php?

0 Answers  


What is a string in r?

0 Answers  


What are the advantages of triggers in php?

0 Answers  


What are getters and setters php?

0 Answers  


What are advantages of .htaccess?

0 Answers  


How can I learn php fast?

0 Answers  


Categories