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.
PHP iPad Detection Code
if(strstr($_SERVER[’HTTP_USER_AGENT’],"iPad"))
{
header("Location: http://ipad.yourdomain.com");
}
?>
PHP iPhone Detection Code
if(strstr($_SERVER[’HTTP_USER_AGENT’],"iPhone"))
{
header("Location: http://iphone.yourdomain.com");
}
?>
Posted by: - Fri, Jun 10, 2011. This article has been viewed 2877 times.
Online URL: https://www.articlediary.com/article/php-code-to-detect-iphone-and-ipad-939.html

Powered by PHPKB (Knowledge Base Software)