I have an app which posts a status update with a link onto a users facebook wall. If anyone then clicks on the link in the status they need to be redirected to the relevant page based on whether they are viewing on an iPhone, ipod, iPad or PC/Mac
So my php code in my link page is:
<?php
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPod') || strstr($_SERVER['HTTP_USER_AGENT'],'iPhone')) {
header('Location: iphone app redirect...');
}
else if(strstr($_SERVER['HTTP_USER_AGENT'],'iPad')) {
header('Location: ipad app redirect...');
}
else {
header('Location: website link redirect');
}
?>
Problem is that it is picking up the iPhone and website redirect correctly but not the iPad. When on iPad it takes you to the iPhone link.
I've checked the output for the user agent as i wasnt sure whether coming from facebook might mean it doesn't send it correctly but on an iPad and it comes out with:
Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53
So the strstr
should surely pick up the iPad?