Created
August 28, 2014 15:22
-
-
Save melloc01/34f3309a0b0d08e6171b to your computer and use it in GitHub Desktop.
PHP - Check mobile devices by HTTP_USER_AGENT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$android = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"android"); | |
$ipad = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"ipad"); | |
$iphone = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"iphone"); | |
$ipod = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"ipod"); | |
if ( ($android === false) && ($ipad === false) && ($iphone === false) && ($ipod === false) ) | |
$mobile = "false"; | |
else | |
$mobile = "true"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment