[Solved] How to get Browser Information + Time Stamp with PHP [closed]


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

$browser = get_browser(null, true);
print_r($browser);
?>

source1

There are other parameters in $_SERVER super global variable that you might find helpful as well such as time info. check for that here

GetDate() for getting date

<?php
$today = getdate(); <---- In correct (updated below)
print_r($today);
?>

source2

Updated Answer

You cannot get browser time from PHP because PHP runs on the server. It knows nothing about client and is completely ignorant of client time. But you can use JavaScript inside PHP and hack the browser time, like this

echo "<script type=\\"text/javascript\\">";
    echo "localtime = new Date();";
    echo "document.location.href="https://stackoverflow.com/questions/10247038/$PHP_SELF?client_time=" + localtime.getTime();";
    echo "</script>";

More on this on sitepoint

4

solved How to get Browser Information + Time Stamp with PHP [closed]