Detecting iPhone visitors with PHP

More and more internet traffic is generated by the iPhone and iPod touch.

The PHP snippet below shows you how to automatically redirect your users to a page which is optimized for the iPhone Safari browser.

Select Code
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))
{
// Change your URL below
header('Location: http://www.domain.com/iphone');
exit();
}

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>