Few days back we had a requirement on how to detect iPhone and iPad so that we can divert the traffic to a different location. Here is a quick SERVER side code in PHP which can achieve this:
<?php
$isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad');
$isiPhone = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPhone');
if($isiPad == true || $isiPhone == true) {
echo "Ipad - Iphone";
}
?>
You can test out the code by visiting: Link on your iPad or iPhone