Inspiration For Creative Minds
Home » Labs » iPad and iPhone Detection using PHP  

Filed under Labs

Here is a php script which helps to detect the user agent easily.The PHP script uses the $_SERVER['HTTP_USER_AGENT'].

<?php
echo($_SERVER[‘HTTP_USER_AGENT’]);
?>

PHP script to detect iPad and redirecting to other page

<?php
    if(strstr($_SERVER['HTTP_USER_AGENT'],’iPad’))
  {
       header(‘Location: www.vishmax.com/contact/);
  }
 
?>

iPhone detection using PHP

<?php
     if(strstr($_SERVER['HTTP_USER_AGENT'],’iPod’))
   {
 
       header(‘Location: www.vishmax.com/blog/);
   }
 
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: