detect iphone browser

Posted on 2011-05-02
Last Modified: 2012-05-11
$browser = $_SERVER['HTTP_USER_AGENT'];

what is iphone broswer

how can I do an
if iphone browser
do something
Question by:rgb192
    LVL 13

    Accepted Solution

    //setting the variables
    $ipod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
    $iphone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
    //detecting device
    if ($ipod == true || $iphone == true){
    header( 'Location: http://site-1/' ) ;
    } else {
    header( 'Location: http://site-2/' ) ;

    Open in new window

    This will detect iphone or ipod browser then redirect the page.
    LVL 13

    Expert Comment

    Change the page you want it to go after the LOCATION:

    Author Closing Comment


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to dynamically set the form action using jQuery.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now