• About Us
  • Blog
  • Basket
  • Account
  • Sign In
  •  

Blog

Published on Tuesday, October 2, 2012

51degrees.mobi PHP Device Detection using PHPCloud

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:

  5. include_once(‘path/to/51Degrees.mobi.php’);
    include_once(‘path/to/51Degrees.mobi.usage.php’);

  6. Use the following code to start detecting mobile devices:

    if($_51d[‘IsMobile’] == ‘True’)
    {
      //Start coding for a mobile device here.
    }
  7. Property values can be accessed and outputted like so:

    echo ‘Layout Engine:'.$_51d[‘LayoutEngine’];

A working example can be found at the address: http://fiftyonedegrees.my.phpcloud.com/example/index.php and the source code can be downloaded from here.

Comments (0)

Author: Products Team

Categories: Development

Tags: Device Detection , PHP

Chris Brautigam
>

Products Team

Other posts by Products Team
Contact author

Name:
Email:
Subject:
Message:
x

Tags

.NET 4G 51Degrees 5G Acer Adform Adtech Advertising Afilias Alcatel Amazon AMP Analysis Analytics Android Apache API Apple Asian Market ASP.NET Asus Blackberry Browser C C# Centro Chrome Cloud CMS CPU CSS3 Data Data Blog Data File Daydream Design Detection Developers Device Device Data Device Detection Device Intelligence Device Models Device property DeviceAtlas Disney dmexco DotNetNuke Download ebay Ericsson Event Facebook Firefox Foundation Framework Galaxy git repositories Google Google Analytics Google Daydream GPU GSMA Guess HAProxy Hash Trie HTC HTML5 HTTP HTTP Headers Huawei Infinix Ingeniux Internet usage iOS iOS 13 ipad iPadOS iPhone iPhone 11 Java Javascript Kentico LG Liferay LTE m.dot Memory Memory leak Meta Data Microsoft Mobile Mobile Analysis Mobile Analytics Mobile Devices Mobile Marketing Mixer Motorola Mozilla MWC MWC 2017 MWC16 Native Apps NET New Release News Nexus NFC NGINX Nokia OnePlus 5 Opera Operating System Oppo Optimisation OS Patent Performance PHP Press Release Price Band programmatic Publishers Python Redirection Research Responsive Images Responsive web design RESS Review RTB RWD Safari Samsung Scala ScientiaMobile SEO Server Server-side optimisation Seznam.cz Sitecore Smart TV Smartphone Smartwatches Sony Swedish Beers Tablet Tencent Testing Tips Tutorial Umbraco Update User Agent User-Agent Valgrind Varnish Varnish Cache Video Vodafone VoLTE Web Web Apps Web content management Webtrekk White Paper Widgets WiFi Windows WURFL Xiaomi Xperia ZTE