PHP Classes

userStack: Analyze the user browser using the userStack API

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 71 All time: 10,265 This week: 673Up
Version License PHP version Categories
userstack 1.0.0GNU General Publi...5HTTP, PHP 5, User Management
Description 

Author

This class analyzes the user browser using the userStack API.

It can take the current user browser string identifier and sends a HTTP request to the userStack API Web server so their Web service can analyze it and return the results.

Currently it can return details like the user browser name, device type or user computer operating system.

Picture of Dave Smith
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 51 packages by
Country: United States United States
Age: 59
All time rank: 608 in United States United States
Week rank: 21 Up2 in United States United States Up
Innovation award
Innovation award
Nominee: 32x

Winner: 7x

Example

<?php
/*
example usage
userStack ver 1.0

You must get an API key from https://userstack.com/product
and enter it in the userstack.class.php file
*/

//turning off low level notices
error_reporting(E_ALL ^ E_NOTICE);

//instantiate the class
include('userstack.class.php');
$userStack = new userStack();

//set the user agent to be checked
$ua = $_SERVER['HTTP_USER_AGENT'];
$userStack->setParam('ua',$ua);

//get the response from the api
$userStack->getResponse();

//the response property will contain the response returned from the api
echo '<h4>API response for user agent: '.$ua.'</h4>';
echo
'Operating System: '.$userStack->response->os->name.'<br>';
echo
'Device: '.$userStack->response->device->type.'<br>';
echo
'Browser: '.$userStack->response->browser->name.'<br>';

//full response
echo '<hr>';
echo
'<h4>Full response</h4>';
echo
'<pre>';
var_dump($userStack->response);
echo
'</pre>';

?>


  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file example.php Example Example Usage
Accessible without login Plain text file license.txt Lic. License
Plain text file userstack.class.php Class Main Class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:71
This week:0
All time:10,265
This week:673Up