[insert_php]
// store url
const IOS_STORE = ‘http://appstore.com/mindprober’;
const ANDROID_STORE = ‘https://play.google.com/store/apps/details?id=mindprober.studies.mindprober’;
// redirect function
function redirect($url, $statusCode = 303)
{
header(‘Location: ‘ . $url, true, $statusCode);
die();
}
//Detect special conditions devices
$iPod = stripos($_SERVER[‘HTTP_USER_AGENT’],”iPod”);
$iPhone = stripos($_SERVER[‘HTTP_USER_AGENT’],”iPhone”);
$iPad = stripos($_SERVER[‘HTTP_USER_AGENT’],”iPad”);
$Android = stripos($_SERVER[‘HTTP_USER_AGENT’],”Android”);
$webOS = stripos($_SERVER[‘HTTP_USER_AGENT’],”webOS”);

//do something with this information
if( $iPod || $iPhone || $iPad ){
redirect(IOS_STORE);
} else {
redirect(ANDROID_STORE);
}

[/insert_php]