Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Detect Mobile Platform On Php

<?php


function detect_platform() {
	if (preg_match('/iphone|ipad|ipod/i', $_SERVER['HTTP_USER_AGENT'])) {
		if (!preg_match('/safari/[0-9]+/i', $_SERVER['HTTP_USER_AGENT'])) {
			return 'ios-share';
		} else {
			return 'ios';
		}
	} else if (stripos($_SERVER['HTTP_USER_AGENT'], 'android')!==false) {
		return 'android';
	} else {
		return 'default';
	}
}
 
PREVIOUS NEXT
Tagged: #Detect #Mobile #Platform #On #Php
ADD COMMENT
Topic
Name
5+4 =