News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Server-Side Device Detection with Browscap
July 25, 2013 @ 13:09:12

In a new tutorial posted to PHPMaster.com today, Lukas White talks about using the Browscap functionality to do server-side device/client detection in your applications.

An alternative solution to the problem is to use server-side device detection and then take certain actions based on that information. One possibility is to simply forward requests for a mobile site to a different URL. Another possibility is to adapt the layout - or indeed content - programmatically as it's generated on the server. Taking a server-side approach is the basis of this article, which looks in detail at the Browser Capabilities Project, or Browscap for short, to provide the information on which to base these decisions.

He starts with some of the basics - User-Agent strings that most devices will send to your site and their structure. He then talks about the Browscap project and the PHP support for its use. He shows how to get it all installed via Composer and how to use the "browscap-php" library to get the current browser information. He includes an example of the output and shows how to use this to redirect the user to a mobile site if needed. He also adds in a bit at the end about using it for layout switching or for showing the user the correct download links based on their client.

0 comments voice your opinion now!
serverside useragent browscap tutorial detection

Link: http://phpmaster.com/server-side-device-detection-with-browscap

blog comments powered by Disqus

Similar Posts

The Shadow Fox Network: Building a Better Blog - Part 1 & 2

The Bakery: Four New Articles - Load Balancing, Request Info, UUID Behavior & Upload Thumbnails

IBM developerWorks: Understanding the Zend Framework, Part 2 (MVC & a Database)

CatsWhoCode.com: How to make a translatable WordPress theme

MaltBlue.com: \Zend\Db\Sql - Creating Joins and Unions with Ease


Community Events











Don't see your event here?
Let us know!


unittest language security hhvm composer podcast component package overview opinion install symfony2 release dependency facebook hack introduction series framework application

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework