-
-
Save hborras/47313940b539316dab1c189923d4785b to your computer and use it in GitHub Desktop.
[PHP] Auto redirect to app store. (Android/IOS)
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 | |
// android store | |
if (preg_match('#android#i', $_SERVER ['HTTP_USER_AGENT'])) { | |
header('Location: market://details?id=com.google.android.apps.maps'); | |
exit; | |
} | |
// ios | |
if (preg_match('#(iPad|iPhone|iPod)#i', $_SERVER ['HTTP_USER_AGENT'])) { | |
header('Location: itms://itunes.apple.com/us/app/google-maps-real-time-navigation/id585027354?mt=8'); | |
exit; | |
} | |
// for another os | |
echo $_SERVER ['HTTP_USER_AGENT']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment