51Degrees-Logo

51degrees.mobi PHP Device Detection using PHPCloud

Engineering

10/2/2012 5:14 PM

Device Detection PHP Development

To use 51Degrees.mobi with myPHPCloud you need to:

  1. Create a PHPCloud account, then create a container of your choosing and put an application within it.
  2. Download the 51Degrees.mobi PHP solution from SourceForge.
  3. Extract the contents of the download and upload the contents to the directory of your choosing in your application repository. For help on where to put files please see the "File Locations and Permissions" section of the PHPCloud help documentation.
  4. Create a php file in your public folder and add include statements to the files "51degrees.mobi.php" and "51Degrees.mobi.usage.php". It should be noted that "51Degrees.mobi.usage.php" is an optional addition that shares usage data to help improve the product. If you do not wish to share usage data, please do not include it. The location of these files depends on step 3: include_once(‘path/to/51Degrees.mobi.php’); include_once(‘path/to/51Degrees.mobi.usage.php’);
  5. Use the following code to start detecting mobile devices: if($_51d[‘IsMobile’] == ‘True’) { //Start coding for a mobile device here. }
  6. Property values can be accessed and outputted like so: echo ‘Layout Engine:'.$_51d[‘LayoutEngine’];