Last active
December 14, 2015 07:48
-
-
Save vivirenremoto/5052719 to your computer and use it in GitHub Desktop.
Detecta el dispositivo móvil y redirige a su versión correspondiente con un sólo código QR
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
<?php | |
$user_agent = $_SERVER['HTTP_USER_AGENT']; | |
switch( true ){ | |
case preg_match('/iphone|ipad/si',$user_agent): | |
$url = 'https://itunes.apple.com/us/app/whatsapp-messenger/id310633997?mt=8'; | |
break; | |
case stristr($user_agent, 'android'): | |
$url = 'https://play.google.com/store/apps/details?id=com.whatsapp&hl=es'; | |
break; | |
case stristr($user_agent, 'windows phone'): | |
$url = 'http://www.windowsphone.com/en-us/store/app/whatsapp/218a0ebb-1585-4c7e-a9ec-054cf4569a79'; | |
break; | |
case stristr($user_agent, 'blackberry'): | |
$url = 'http://appworld.blackberry.com/webstore/content/2360/?countrycode=ES'; | |
break; | |
default: | |
$url = 'http://www.whatsapp.com/'; | |
break; | |
} | |
header( 'Location: ' . $url ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment