Search results for '2010/06'. 1 post(s) found.

  1. 2010/06/22 How to get browser information in PHP?
2010/06/22 17:01

How to get browser information in PHP?


PHP provides to get Browser Information by function. Below is the simple example.

<?php
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
?>


Above example may display as following, if you use FireFox.

Mozilla/5.0 (Windows; U; Windows NT 5.1; ko; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)

In order to get above variable on function, you need to declare on top of the function as below.

function foo()
{
  global $_SERVER;

  echo $_SERVER['HTTP_USER_AGENT'];
}

Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.