How can we get the browser properties using PHP?

by AdneyP
3 replies
How can we get the browser properties using PHP?
#browser #php #properties
  • Profile picture of the author robomedia
    Which properties?
    Generally PHP resides on your server and it has nothing to do with the client ( web browser ) .
    You can get only what browser sends you : referrer and user agent string .
    There's some php function get_browser() that will get some info based on user agent string (PHP: get_browser - Manual) .

    But generally Javascript is the language that talks directly with your browser, so you might gather the required information with javascript and then send it to server by ajax.
    {{ DiscussionBoard.errors[10426730].message }}
  • Profile picture of the author Yadav Poonam
    You can use get_browser() function

    $browser_details = get_browser(null, true);
    print_r($browser_details);
    {{ DiscussionBoard.errors[10426731].message }}
  • Here's the code

    <?php
    echo $_SERVER['HTTP_USER_AGENT'] . “\n\n”;
    $browser = get_browser();
    print_r($browser);
    ?>
    {{ DiscussionBoard.errors[10426770].message }}

Trending Topics