PHP Code to Detect iPhone and iPad
Here is the PHP code to detect if a user is browsing your website from iPad or iPhone. If you want to detect iPad and iPhone browser then following snippet will help you to redirect users to new page specifically designed for iPhone or iPad devices.
if(strstr($_SERVER[’HTTP_USER_AGENT’],"iPad"))
{
header("Location: http://ipad.yourdomain.com");
}
?>
if(strstr($_SERVER[’HTTP_USER_AGENT’],"iPhone"))
{
header("Location: http://iphone.yourdomain.com");
}
?>
Article ID: 939
Created: Fri, Jun 10, 2011
Last Updated: Sat, Jul 23, 2011
Author: Administrator
Online URL: https://www.articlediary.com/article/php-code-to-detect-iphone-and-ipad-939.html